Jump to content

Can AutoIt get the Page Source


Recommended Posts

Do you have an example page where you see this issue with ?

<{POST_SNAPBACK}>

Just to revive this, Im creating a script that will check my emails for me and alert me if I have any new ones... I get the source from the page check it for gif that is the new email sign, and tells me how many it found, thus telling me how many new/unopened emails I have.

I am using hotmail and this is were I get the source from. If I go to the link directly with my web browser (Mozilla) and click View Source, I get the source of the page. But if I use InetGet on the same email address I get something different such as...

<html><head><script language="javascript">var submitted = false;function DoSubmit(){if (!submitted){submitted = true;document.hiddenform.submit();}}function OnBack(){}</script></head><body 
onload="javascript:DoSubmit();"><form name=hiddenform action="http://login.passport.net/uilogin.srf?id=2" method=POST target="_top"><input type=hidden name="mspprawqs" value="aWQ9MiZzdmM9bWFpbCZjYmlkPTI0MzI1Jm1zcHBqcGg9MSZ0dz0wJmZzPTEm
ZnNhPTEmZnNhdD0xMjk2MDAwJmxjPTEwMzMmX2xhbmc9RU4mcm9sbHJzPTEx"><BR><input type=hidden name="mspppostint" value="cHJlPXZvbGNvbV9zdG9uZTQ0QGhvdG1haWwuY29tJnVpY29kZT0w"><BR><noscript><META HTTP-EQUIV="REFRESH" CONTENT="0; URL=http://memberservices.passport.net/MSRV_JSRequired.srf?lc=1033&id=2&svc=
mail&cbid=24325&msppjph=1&tw=0&fs=1&fsa=1&fsat=1296000&lc=1033&_lang=EN&rollrs=11">
</noscript></form></body></html>

Im pretty sure it has to do with the 'security issues'. I've tried getting the source with InetGet whilst have the web page open on Mozilla and still no luck...

Is there any way around this?

Also how can I use wouter's eg of using COM.

$httpObj = ObjCreate("winhttp.winhttprequest.5.1")
$httpObj.open("GET",$URL)
$httpObj.send()

$HTMLSource = $httpObj.Responsetext
Edited by Burrup

qq

Link to comment
Share on other sites

straight from the test files :)

; WINHTTP Object example
; 
; Retrieve the HTML source from a given URL
;
; Derived from a KiXtart script BBCodeParser.kix by Lonkero
;
; See also: http://www.gwspikval.com/jooel/scripts/BBCodeParser/Older%20versions/2.0.1/BBCodeParser2.kix
; and
; http://msdn.microsoft.com/library/en-us/winhttp/http/winhttprequest.asp

$URL="http://www.AutoItScript.com"

#include "GUIConstants.au3"

; Create a simple GUI for our output
GUICreate ( "Event Test", 640, 480 )
$GUIEdit=GUICtrlCreateEdit ( "HTTP Source Test:" & @CRLF, 10, 10 , 600 , 400 )
GUISetState ()    ;Show GUI


$httpObj = ObjCreate("winhttp.winhttprequest.5.1")
$httpObj.open("GET",$URL)
$httpObj.send()

$HTMLSource = $httpObj.Responsetext

GUICtrlSetData ( $GUIEdit, "The HTML source of " & $URL & " is:" & @CRLF & @CRLF & StringAddCR($HTMLSource) , "append" )

; Waiting for user to close the window
While 1
   $msg = GUIGetMsg()
   If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

GUIDelete ()

exit

My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll

Link to comment
Share on other sites

Again Im getting something different to what the source is... I get this, talking about how the browser isnt supported

HTTP Source Test:
The HTML source of "webpage here" is:





<html dir="ltr">

<head>

  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

  <title>Browser Not Supported</title>

  <link rel="stylesheet" type="text/css" href="/1033/C/PPNetScape.css">

  

</head>

<body topmargin="0" leftmargin="0" rightmargin="0" marginheight="0" marginwidth="0" class="PPPageBG">

<center>

<table cellpadding="0" cellspacing="0" border="0">

  <tr>

    <td><img src="/images/T.gif" width="1" height="20" border="0"></td>

  </tr>

</table>

<table cellpadding="0" cellspacing="0" border="0" width="500">

<tr>

  <td class="PPModuleBrd"><img src="/images/T.gif"></td>

  <td class="PPModuleBrd"><img src="/images/T.gif" width="498" height="1" border="0"></td>

  <td class="PPModuleBrd"><img src="/images/T.gif"></td>

</tr>

<tr>

  <td class="PPModuleBrd"><img src="/images/T.gif"></td>

  <td class="PPDynamicTbl">

<table cellpadding="0" cellspacing="0" border="0" width="100%" class="PPModuleTtlTbl">

  <tr>

    <td rowspan="2"><img src="/images/T.gif" width="10" height="1" border="0"></td>

    <td width="100%"><img src="/images/T.gif" width="1" height="3" border="0"></td>

    <td rowspan="2"><img src="/images/T.gif" width="10" height="1" border="0"></td>

  </tr>

  <tr>

    <td valign="middle" nowrap class="PPModuleTtlTxt">Browser Not Supported<br><img src="/images/T.gif" width="1" height="3" border="0"></td>

  </tr>

</table>

<table cellpadding="0" cellspacing="0" border="0" width="100%">

  <tr>

    <td rowspan="3"><img src="/images/T.gif" width="10" height="1" border="0"></td>

    <td width="100%"><img src="/images/T.gif" width="1" height="10" border="0"></td>

    <td rowspan="3"><img src="/images/T.gif" width="10" height="1" border="0"></td>

  </tr>

  <tr>

    <td width="100%" valign="top" class="PPDesTxt">Microsoft&reg; .NET Passport no longer supports the Web browser version you are using. Please upgrade to a current Web browser, such as Microsoft Internet Explorer version 4.0 or later, or Netscape Navigator version 4.08 or later.</td>

  </tr>

  <tr>

    <td><img src="/images/T.gif" width="1" height="10" border="0"></td>

  </tr>

</table>

<table cellpadding="0" cellspacing="0" border="0" width="100%">

  <tr>

    <td width="100%" colspan="2"><img src="/images/T.gif" width="1" height="25" border="0"></td>

  </tr>

  <tr>

    <td width="100%" valign="bottom"><table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td background="/images/yellow.gif"><img src="/images/T.gif" width="1" height="4" border="0"></td></tr></table></td>

    <td align="right"><a href="http://www.passport.net/default.asp?lc=1033&id=2&cbid=24325"  target="_top"><img src="http://www.passportimages.com/1033/dotnetlogoBIG.gif" alt="www.passport.com" height="34" width="153" border="0"></a></td>

  </tr>

</table>

<!-- ServerInfo: BAYPPLOGN2B16 2005.03.08.19.51.43 Live1 HMStage:4 MSNIAStage:1 -->


<!-- PreprocessInfo: PASSBLD04, Wed Jan 12 07:40:50 2005

 -->

  </td>

  <td class="PPModuleBrd"><img src="/images/T.gif"></td>

</tr>

<tr>

  <td class="PPModuleBrd"><img src="/images/T.gif"></td>

  <td class="PPModuleBrd"><img src="/images/T.gif" width="498" height="1" border="0"></td>

  <td class="PPModuleBrd"><img src="/images/T.gif"></td>

</tr>

</table>

<!-- User-Agent:Mozilla/4.0 $compatible$ Win32$ WinHttp.WinHttpRequest.5$ -->  

</center>

</body>

</html>

sry about it being so big

Edited by Burrup

qq

Link to comment
Share on other sites

  • 4 weeks later...

hmm too bad that inetget cannot send a custom user-agent header

that could solve the problem

But there is a way if you create a new inetget function using the tcp functions (wich are in the beta and some addon dll)

But thats some work because you have to send correct http headers too

(wich also makes it much more useable ) and handle the tcp connection

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...