Joboy2k Posted August 21, 2018 Share Posted August 21, 2018 (edited) Hi there, i'm having a little trouble loading/reading the HTML from this website https://getaddress.io/ this is what the email they sent me with my API key says to do For example: 'https://api.getAddress.io/find/sw1a2aa?api-key=ws4rBBEfakGBhnkWgsyy9Q15005' when I use this script I wrote (which has had no problem in the past retrieving HTML from websites) it seems to freeze, am I doing something wrong? is it the wrong way to use it? I'm really lost sorry. it also comes up with some strange message at the bottom of the IE window (supplied photo displays) ;TEST #include <IE.au3> $Postcode = "CM14 4SD" ; RANDOM FOR TESTING $HTML = _READHTML("https://api.getaddress.io/find/"&stringreplace($postcode," ","")&"?api-key=ws4rBBEfakGBhnkWgsyy9Q15005", 8000, 1) If Not @error Then $sFilePath = @DesktopDir & "\IE RESULTS " & @HOUR&@MIN&@SEC & ".txt" $hFileOpen = FileOpen($sFilePath, $FO_APPEND) FileWrite($hFileOpen, $html) FileClose($hFileOpen) EndIf Func _READHTML($WebsiteHTML, $_HTMLtimeout = 8000, $HTML_Visible = 0, $_HTMLTimerMAX = 8000) If $WebsiteHTML = "" then Return(SetError(1, 0, "No website provided")) $_HTMLTimer = TimerInit() If not ($WebsiteHTML = "") then Do $oIE = _IECreate($WebsiteHTML, 0, $HTML_Visible) $oIEResults = _IEBodyReadText ( $oIE ) Until ($oIEResults <> "") or (TimerDiff($_HTMLTimer) >= $_HTMLTimerMAX) or @error _IEQuit($oIE) If $oIEResults = "" then Return(SetError(2, 0, "Timed out")) Return($oIEResults) EndIf EndFunc Also when I type into an IE explorer window that I open myself it gets all the results as expected, just not working when using a script Edited August 21, 2018 by joboy2k Link to comment Share on other sites More sharing options...
Danp2 Posted August 21, 2018 Share Posted August 21, 2018 Instead of using the _IE functions, I would use the WinHTTP UDF. Here's an example -- #include <WinHttp.au3> GetAddresses('sw1a2aa') Func GetAddresses($sPostCode) Local $sDomain = "api.getaddress.io" Local $sPage = "find/" Local $sAdditionalData = '?api-key=ws4rBBEfakGBhnkWgsyy9Q15005' Local $hOpen = _WinHttpOpen() Local $hConnect = _WinHttpConnect($hOpen, $sDomain, $INTERNET_DEFAULT_HTTPS_PORT) Local $sReturned = _WinHttpSimpleSSLRequest($hConnect, "GET", $sPage & $sPostCode & $sAdditionalData) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) ConsoleWrite("+ Returned = " & $sReturned & @CRLF) EndFunc Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Danyfirex Posted August 21, 2018 Share Posted August 21, 2018 You could probably use InetRead/InetGet Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
Joboy2k Posted August 22, 2018 Author Share Posted August 22, 2018 Both brilliant options and both work perfectly for what I need. Thank you so much. Was I doing something specifically wrong? or was I just asking something that isn't possible for the method I was using? Many thanks again Link to comment Share on other sites More sharing options...
Danp2 Posted August 22, 2018 Share Posted August 22, 2018 47 minutes ago, joboy2k said: Was I doing something specifically wrong? or was I just asking something that isn't possible for the method I was using? Just using the wrong tool for the job. 😁 Danyfirex 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now