Jump to content

Trying to get html source from website that uses Java


Recommended Posts

Good Morning All AutoIT Gurus,

 :ILA2:

Does anyone know how I can get the right responses for Inet.au3 or IE.au3 for sites that check your browser, os, etc using Javascript? For some reason the source is empty using the built-in tools in AutoIT... doesn't contain the version information when reading using inetgetsource or iedocreadhtml ... The point is to find out the latest version automatically using AutoIT tools. 

Example: https://get.adobe.com/flashplayer/

#include <Inet.au3>
$OpenHTML01 = _INetGetSource("https://get.adobe.com/flashplayer/")
MsgBox (0, "", $OpenHTML01)

A typical page response would include...

"Version 18.0.0.232
System requirements"

... within the <div id="autoSelectedVersion"> tag.

Thanks!!!

:huh2:

UPDATE: I believe it's this file that determines what OS, language, x32, x64, browser, etc that you are using and then reports it back...
https://wwwimages2.adobe.com/downloadcenter/js/live/polarbear.js

 

Edited by souldjer777

"Maybe I'm on a road that ain't been paved yet. And maybe I see a sign that ain't been made yet"
Song Title: I guess you could say
Artist: Middle Class Rut

Link to comment
Share on other sites

option 1: set the header HttpSetUserAgent("MyUserAgent") based on that adobe website sends something else

option 2 http over tcp socket (not working, something about not receiving the response) probably rewrite with UDP* functions

Example()
;~ https://get.adobe.com/flashplayer/?loc=nl
Func Example()
    $Host="get.adobe.com"
    Opt("TCPTimeout", 1000) ;1000 milliseconds

    TCPStartup() ; Start the TCP service.

    ; Register OnAutoItExit to be called when the script is closed.
    OnAutoItExitRegister("OnAutoItExit")

    ; Assign Local variables the internet Address and the Port.
;~  "https://" &
    Local $sIPAddress = TCPNameToIP( $Host)
    Local $iPort = 443 ; 80 ; Port used for the connection. HTTPS=443 normally

    ; Assign a Local variable the socket and connect to a Listening socket with the IP Address and Port specified.
    Local $iSocket = TCPConnect($sIPAddress, $iPort)
    consolewrite("Connect to " & $sIPAddress & " on port 443 ... " & @error & @CRLF)

    TCPSend($iSocket, "GET /flashplayer HTTP/1.1" & @CRLF)

    TCPSend($iSocket, "Host: " & $Host & @CRLF)
    TCPSend($iSocket, "Connection: close" & @CRLF)
;~      TCPSend($iSocket, "Connection: Keep-Alive" & @CRLF)
;~  TCPSend($iSocket, "User-Agent: AutoIT RAW HTTP" & @CRLF)
    TCPSend($iSocket, "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)" & @CRLF)
    TCPSend($iSocket, "Cache-Control: no-cache" & @CRLF)
    TCPSend($iSocket, @CRLF)         ;        # end of request.

    $data=TCPRecv($iSocket, 4096 )
;~  $data=TCPRecv($iSocket, 16 )
    consolewrite("Data:" & @error & $data & @CRLF)

    $allData=""
    while (@Error=0)
;~      TCPSend($iSocket, @CRLF)         ;        # end of request.

        $allData=$allData&$data
        $data=TCPRecv($iSocket, 2048,1 )
    WEnd
    $allData=$allData&$data

    consolewrite($allData)
EndFunc   ;==>Example

Func OnAutoItExit()
    TCPShutdown() ; Close the

 

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

×
×
  • Create New...