KurogamineNox Posted October 16, 2010 Share Posted October 16, 2010 (edited) [issue: Unsolved] Id like to know how to use TCP to grab the HTML source from a website. Could someone help me out with this? If Possible. Edited October 16, 2010 by KurogamineNox Link to comment Share on other sites More sharing options...
water Posted October 16, 2010 Share Posted October 16, 2010 (edited) Why do you want to use TCP? Couldn't you use the IE UDF and function _IEBodyReadHTML or _IEDocReadHTML? Edited October 16, 2010 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
trancexx Posted October 16, 2010 Share Posted October 16, 2010 (edited) ...ahh, he edited. Edited October 16, 2010 by trancexx ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
water Posted October 16, 2010 Share Posted October 16, 2010 ...ahh, he edited.I like that emoticon.That describes how I feel (sometimes) My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
trancexx Posted October 16, 2010 Share Posted October 16, 2010 Anyway, KurogamineNox should just search the forums before asking others to do that for him. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
KurogamineNox Posted October 16, 2010 Author Share Posted October 16, 2010 TCP because I dont want to acually load the site in a browser. Link to comment Share on other sites More sharing options...
water Posted October 16, 2010 Share Posted October 16, 2010 If you use the IE UDF you won't even see the browser. Example: #include <IE.au3> $oIE = _IECreate ("www.autoitscript.com",0,0) $sHTML = _IEDocReadHTML ($oIE) _IEQuit ($oIE) MsgBox(0, "Document Source", $sHTML) My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
KurogamineNox Posted October 16, 2010 Author Share Posted October 16, 2010 If you use the IE UDF you won't even see the browser. Example: #include <IE.au3> $oIE = _IECreate ("www.autoitscript.com",0,0) $sHTML = _IEDocReadHTML ($oIE) _IEQuit ($oIE) MsgBox(0, "Document Source", $sHTML) I just think TCP would load the html source in a more efficient way, but I am not sure with most of these things. Link to comment Share on other sites More sharing options...
trancexx Posted October 16, 2010 Share Posted October 16, 2010 If you use the IE UDF you won't even see the browser. Example: #include <IE.au3> $oIE = _IECreate ("www.autoitscript.com",0,0) $sHTML = _IEDocReadHTML ($oIE) _IEQuit ($oIE) MsgBox(0, "Document Source", $sHTML) Nevertheless, another process is started. This is why I don't like _IE... When something can be done within your (process's) memory space, another process shouldn't be started unless absolutely needed, or when profits are bigger than losses. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
trancexx Posted October 16, 2010 Share Posted October 16, 2010 I just think TCP would load the html source in a more efficient way, but I am not sure with most of these things.Just read about InetRead funtion, or search TCP port 80, or find WinHttp.au3, or thousand other things. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
KurogamineNox Posted October 16, 2010 Author Share Posted October 16, 2010 Anyway, KurogamineNox should just search the forums before asking others to do that for him.Btw, I really havnt asked anyone to do it for me. I just asked if someone could teach me how to use TCP. Maybe send me to another page that already has something I need since I am a complete novice at TCP functions and its just confusing me in the help file. Link to comment Share on other sites More sharing options...
KurogamineNox Posted October 16, 2010 Author Share Posted October 16, 2010 Just read about InetRead funtion, or search TCP port 80, or find WinHttp.au3, or thousand other things.hm...Ill see what I can come up with. Link to comment Share on other sites More sharing options...
KurogamineNox Posted October 16, 2010 Author Share Posted October 16, 2010 I added the INetRead to my coding $oIE = INetRead("http://rf.ogplanet.com/community/rankings.html") $text = _IEBodyReadHTML($oIE) $aRanking = StringRegExp($text, "(?:<SPAN id=myrank>)(\d*)(?:</SPAN>)", 1) $ranking = $aRanking[0] GuiCtrlSetData($label, $ranking) problem is I think im using it wrong. Link to comment Share on other sites More sharing options...
water Posted October 16, 2010 Share Posted October 16, 2010 (edited) $text = INetRead("http://rf.ogplanet.com/community/rankings.html") $aRanking = StringRegExp($text, "(?:<SPAN id=myrank>)(\d*)(?:</SPAN>)", 1) $ranking = $aRanking[0] GuiCtrlSetData($label, $ranking) Edited October 16, 2010 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
KurogamineNox Posted October 16, 2010 Author Share Posted October 16, 2010 $text = INetRead("http://rf.ogplanet.com/community/rankings.html") $aRanking = StringRegExp($text, "(?:<SPAN id=myrank>)(\d*)(?:</SPAN>)", 1) $ranking = $aRanking[0] GuiCtrlSetData($label, $ranking) Error, id think I need to have it wait till its done downloading, Or its not able to access the stuff from the page. Since you have to be logged in to get your Rank but I think it go off of your internet explorer logins so I logged in there but nothing. Maybe ill have to make a topic on exactly what I need but then that make me lazy and not try things myself(which im trying things myself rightnow.) Link to comment Share on other sites More sharing options...
water Posted October 16, 2010 Share Posted October 16, 2010 (edited) But you should get results for the specified page (no login required for that). I modified the script to display the error and extended code. What do you get? $text = INetRead("http://rf.ogplanet.com/community/rankings.html") msgbox(0,"","error: " & @error & @CRLF & "extended: " & @extended) $aRanking = StringRegExp($text, "(?:<SPAN id=myrank>)(\d*)(?:</SPAN>)", 1) $ranking = $aRanking[0] GuiCtrlSetData($label, $ranking) What do you get? Edited October 16, 2010 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
KurogamineNox Posted October 16, 2010 Author Share Posted October 16, 2010 But you should get results for the specified page (no login required for that). I modified the script to display the error and extended code. What do you get? $text = INetRead("http://rf.ogplanet.com/community/rankings.html") msgbox(0,"","error: " & @error & @CRLF & "extended: " & @extended) $aRanking = StringRegExp($text, "(?:<SPAN id=myrank>)(\d*)(?:</SPAN>)", 1) $ranking = $aRanking[0] GuiCtrlSetData($label, $ranking) What do you get? $ranking = $aRanking[0] $ranking = $aRanking^ ERROR the $ranking errors. This happened before when it tried to read the page when it wasnt fully loaded(from my other experiments.) Link to comment Share on other sites More sharing options...
water Posted October 16, 2010 Share Posted October 16, 2010 $ranking = $aRanking[0] $ranking = $aRanking^ ERROR the $ranking errors. This happened before when it tried to read the page when it wasnt fully loaded(from my other experiments.) That shows that the array is empty. But what does the msgbox command display? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
KurogamineNox Posted October 16, 2010 Author Share Posted October 16, 2010 (edited) error: 0 extended: 13474 Edit: Also login was required in order to acually view your own rank. I am trying to adapt it to another coding of mine that someone helped fix for me. #include <IE.au3> #include <String.au3> $oIE = _IEAttach("Rankings") $text = _IEBodyReadHTML($oIE) $aRanking = StringRegExp($text, "(?:<SPAN id=myrank>)(\d*)(?:</SPAN>)", 1) $ranking = $aRanking[0] ConsoleWrite($ranking & @CRLF) Exit Since I am making a Tracking thing to check for changes in the page(but you can only see changes if you where logged in though.) This code works however it only works after checking teh website. I need mine to able to check the website without having to go to it but logged in at least. So I thought TCP would be just fine. Edited October 16, 2010 by KurogamineNox Link to comment Share on other sites More sharing options...
water Posted October 16, 2010 Share Posted October 16, 2010 That's fine. It means: The function ran successfully and returned 13474 bytes of data. In this case your regexp must be wrong My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki 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