Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get contents of web page 1

Status
Not open for further replies.

DanT07

Programmer
May 11, 2005
38
0
0
GB
Hi everyone

Ive been pulling my hair out with this problem and i cant find anything on the net to help. Basically i want to get the contents of a remote web page and check it for certain text. Ive tried using this javascript method:

<script language=javascript runat=server>
var url = " var xmlhttp = new ActiveXObject("MSXML2.ServerXMLHTTP");
xmlhttp.open("GET", url, 0);
xmlhttp.send("");
content=xmlhttp.responseText;
</script>

Problem is it runs at the server so i cant do anything with the code. Is there a way to do it with ASP so i can get the content into an ASP variable?

Thanks for any help
Dan
 
set oXMLHTTP = server.CreateObject("MSXML2.ServerXMLHTTP.4.0")
the rest of the syntax is very similar.
here's an example found via googling:
there should be plenty more, search on "server XMLHTTP ASP VBscript" and you should get some other examples too.

If these don't help with what you want to do, post back and I'll post an example.


A smile is worth a thousand kind words. So smile, it's easy! :)
 

Also, on this site: thread333-889171

This is one of todays posts - the actual 'get' wasn't the issue, it was the XML parsing - so the initial bit should give you another simple example to work from.

(The server side and client side XMLHTTP work very similar and both Javascript and VBScript have very similar syntax / methods / properties etc.)

A smile is worth a thousand kind words. So smile, it's easy! :)
 
Thanks guys

Ive been searching for ages and couldnt find anything. Im using this code now:

GotothisURL = "url"

' Create the xml object
Set GetConnection = CreateObject("Microsoft.XMLHTTP")
' Conect to specified URL
GetConnection.Open "get", GotothisURL, False
on error resume next
GetConnection.Send

and it works a treat.

Thanks for the help
Dan
 
Thanks guys"

Sorry damber i thought someone else posted above you :D
 

:eek:) no problem, glad you got it sorted.

A smile is worth a thousand kind words. So smile, it's easy! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top