Sign in to follow this  
Followers 0
KurogamineNox

Question with TCP

30 posts in this topic

#1 ·  Posted (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 by KurogamineNox

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Why do you want to use TCP?

Couldn't you use the IE UDF and function _IEBodyReadHTML or _IEDocReadHTML?

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

;)

...ahh, he edited.

Edited by trancexx

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

;)

...ahh, he edited.

I like that emoticon.

That describes how I feel (sometimes) :)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Anyway, KurogamineNox should just search the forums before asking others to do that for him.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

TCP because I dont want to acually load the site in a browser.

Share this post


Link to post
Share on other sites

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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#14 ·  Posted (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 by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#16 ·  Posted (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 by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

$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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#19 ·  Posted (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 by KurogamineNox

Share this post


Link to post
Share on other sites

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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
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
Sign in to follow this  
Followers 0