d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Vba Getting Source Code
Add Reply New Topic New Poll
Member
Posts: 21,893
Joined: Mar 27 2009
Gold: 12,408.00
May 29 2014 10:56am
Function GetSource(url As String) As String

With CreateObject("MSXML2.XMLHTTP")
.Open "GET", url
.Send
Do: DoEvents: Loop Until .Readystate = 4
GetSource = .responsetext
.abort
End With

End Function

I am attempting to pass it the following url:

hiscore.runescape.com/index_lite.ws?player=egyptianfury

the source code for that page should simply return:

112215,2192,110364448 241450,86,3778626 262783,83,2894398 269254,88,4582885 293317,87,4217742 266581,82,2434131 170372,82,2563091 257171,88,4710641 89929,99,13530752 282348,84,3153712 46541,99,13650464 190606,84,2964649 191982,86,3821102 84493,86,3811047 141728,80,2003526 54211,95,8780813 190126,73,1030746 104975,80,2058829 156824,73,1038427 197629,77,1542001 113620,79,1813437 27672,99,13628834 97997,82,2517070 172511,73,1000863 123973,83,2768274 113546,89,4857183 80525,75,1211205 -1,-1 -1,-1 51580,1103593 -1,-1 -1,-1 123761,629 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 40109,326 34077,605 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1

But it cannot open.

Why?

It returns Run-time error '-2147467259 (80004005)':
Method 'open' of object 'IXMLHTTPRequest' failed

The same function works with a different, very similar url, but not for this one.

This post was edited by Dontrunaway on May 29 2014 10:57am
Member
Posts: 21,893
Joined: Mar 27 2009
Gold: 12,408.00
May 29 2014 08:17pm
Or if anyone has an easier way to read the text from a webpage. Since the text is the same as the source, if grabbing the text is easier than grabbing the source that would be fine as well for this application.
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
May 29 2014 11:43pm
try including the protocol.

or if you dont need vba, you can just curl it

This post was edited by carteblanche on May 29 2014 11:44pm
Member
Posts: 21,893
Joined: Mar 27 2009
Gold: 12,408.00
May 30 2014 09:10am
Quote (carteblanche @ May 30 2014 12:43am)
try including the protocol.

or if you dont need vba, you can just curl it


I don't know what that means, and I would like to keep the application within Excel so vba is the only language available.
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
May 30 2014 04:58pm
Quote (Dontrunaway @ May 30 2014 11:10am)
I don't know what that means, and I would like to keep the application within Excel so vba is the only language available.


http://hiscore.runescape.com/index_lite.ws?player=egyptianfury
Member
Posts: 21,893
Joined: Mar 27 2009
Gold: 12,408.00
May 30 2014 06:23pm
Quote (carteblanche @ May 30 2014 05:58pm)
http://hiscore.runescape.com/index_lite.ws?player=egyptianfury


<3

Worked ty
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll