Jump to content

Get page source of current page


Recommended Posts

ok ive been messing with something for a few days and i have a few promblems heres my script with the web page edited out im working on something for my website but i dont have the idea copyrighted yet so sorry i wanna be greedy

but here it gose ... ive tried to use this method

#include <IE.au3>
#include <WinAPI.au3>


Global $hWindow, $stRET, $sMsg, $pStruct, $iRET, $I = 1

ShellExecute ("iexplore.exe", "about:blank")
WinWait ("Blank Page")
$oIE = _IEAttach ("about:blank", "url")
_IELoadWait ($oIE)
_IENavigate ($oIE, "url.php")
WinSetState($hWindow, "", @SW_MAXIMIZE)
If $I = 1 Then 
Login() 
ElseIf $I < 1 Then
_IEQuit ($oIE)

EndIf
    

    


Func Login()
FileDelete("C:\test\source.txt")
ShellExecute ("iexplore.exe", "about:blank")
WinWait ("Blank Page")
$oIE = _IEAttach ("about:blank", "url")
_IELoadWait ($oIE)
_IENavigate ($oIE, "url/login.php")
WinSetState($hWindow, "", @SW_MAXIMIZE)
[color="#0000FF"]MouseMove( 420, 324 )
MouseClick("Left")
MouseClick("Left")
MouseClick("Left")[/color]
Send( "{BS}" )
Send("username")
Sleep( 1000)
MouseMove( 420, 361)
MouseClick( "Left")
Send( "password")
Sleep( 1000 )
Send( "{ENTER}" )
EndFunc
WinSetState($hWindow, "", @SW_Minimize)
Sleep( 2000)
_IENavigate($oIE, "url.php")


$sStr = BinaryToString(InetRead("url.php"))
FileWrite("C:\test" &"\source.txt", $sStr)

ok the Green text is what im using .. it gets the page source of what ever website in place their but the thing is it dosent do it as if i was loged in so im getting page info with out all the data im looking for .. any ideas on what to do

and also the blue text if someone wants to take a stap at it so i can shorten my code my IE keeps rembering my user name so i have to click the feild box 3 times to select the name and i cna paste over it ... i was tring to get it to just click 3 times whne i used the mouseclick("LEFT") command but if i re enter my coords it gives me an error and also one more thing what is the bext way for it to jsut find the username and password feild and enter it id live t run this miniased

Edited by Tokie
Link to comment
Share on other sites

ok well this is a bump and and edit i got the mouse click promblem fixed i was being reatarded and didnt relize i could use mouse click and the cords with out using mousemove

but i still need to get the source of the current page im on and with out entering the webaddress cuz it dosent give me the info im needing its telling me to login

Link to comment
Share on other sites

Did you search the forum for many, many examples of scripts for logging in to web sites? Why would you be messing around with mouse coordinates and Send() when you can address the DOM elements directly with things like _IEFormElementGetObjByName() and _IEFormElementSetValue()?

:mellow:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

i was looking into that but it seams as if the forum its self doesn't have a name ill have to read the source again and mess around with it i just decided to write this being its form my web admin account to check replays and if any payments have been sent or donations if they donated i need to be able to send them the info they get for donating and if the brought something i need to send them the info and time their product will be ready ... sorry i cant really disclose an more info maybe at a later date jut cant now till my copyright is in tact

and i got the page source and got it to write it to a text file so i can extract the info out of it i want

heres the code i used

$sText = _IEBodyReadHTML ($oIE)

FileWrite("C:\test" &"\source.txt", $sText )

now i need to parse the info and write some numbers to an array i guess so i can send them the info and the tranaction number back is that possiable to store it and then rewrite it in a pre wrote message ?

Link to comment
Share on other sites

So, you bought one of these keyboards, didn't you? :mellow:

i was looking into that but it seams as if the forum its self doesn't have a name...

When you can't identify the form element by name, use the 0-based index, or just get the collection of all forms and loop through them looking for the one you want. See _IEFormGetCollection() in the help file.

...ill have to read the source again and mess around with it i just decided to write this being its form my web admin account to check replays and if any payments have been sent or donations if they donated i need to be able to send them the info they get for donating and if the brought something i need to send them the info and time their product will be ready ... sorry i cant really disclose an more info maybe at a later date jut cant now till my copyright is in tact

Seems like you should understand the HTML and the DOM better if you are working with a web site of your own that actually handles money! :party:

and i got the page source and got it to write it to a text file so i can extract the info out of it i want

heres the code i used

$sText = _IEBodyReadHTML ($oIE)

FileWrite("C:\test" &"\source.txt", $sText )
now i need to parse the info and write some numbers to an array i guess so i can send them the info and the tranaction number back is that possiable to store it and then rewrite it in a pre wrote message ?
This is an AutoIt forum for help in learning AutoIt. You have much more to learn about HTML and general web technology than AutoIt for this!

:P

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...