homepage Welcome to WebmasterWorld Guest from 54.211.157.103
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
Forum Library, Charter, Moderators: ocean10000

Microsoft IIS Web Server and ASP.NET Forum

    
Simple read from site
asp
FiRe




msg:953834
 10:39 pm on May 10, 2006 (gmt 0)

Hi,
I do not know ASP but I found part of the code at [asptutorial.info...] and using my patchy visual basic skills I have tried to modify it to make it work.
What it is supposed to do is read the data from a page and output it, after you have sent the appropriate GET variables. I need someone to check this will work, as I am not using it but its just an example to help people on my site:

<%

dim user, auth, length, type, url, contents

' Your User ID
user = "123"

' Your Auth Code
auth = "28F21DZ"

' Length
length = "32"

' Type
type = "1"

' Create the url
url = "http://www.site.com/?user=" & user & "&auth=" & auth & "&length=" & length & "&type=" & type

' Query page
Set GetConnection = CreateObject("Microsoft.XMLHTTP")
GetConnection.Open "get", url, False
GetConnection.Send
contents = GetConnection.responseText
Set GetConnection = Nothing

' Check for errors
If (InStr(contents, "error") > 0) Then
response.write("There was an error generating your data!")

' Output serial key
Else
response.write("Thank you, your data is: " & contents)
End If

%>

If there are any errors please let me know! Also are there any better ways to improve this? Finally can anyone provide a .NET version of this?
Thanks

 

T_Virus




msg:953835
 12:28 pm on May 11, 2006 (gmt 0)

Can't check you code right now but I use this regularly:

Response.Buffer = True
Dim objXMLHTTP, xml
Set xml = Server.CreateObject("Microsoft.XMLHTTP")
xml.Open "GET", "http://www.domain.com/", False
xml.Send
Response.Write(xml.responseText)

FiRe




msg:953836
 4:27 pm on May 11, 2006 (gmt 0)

Yeh I have similar but I think the way to pass GET values is wrong in my script as I am putting them in the url?

FiRe




msg:953837
 11:38 pm on May 19, 2006 (gmt 0)

Can any1 help?

Iguana




msg:953838
 11:43 pm on May 19, 2006 (gmt 0)

A quick thought - the MSXML dll expects a valid XML document (and most webpages aren't). Perhaps try the WINHTTP component?

FiRe




msg:953839
 11:49 pm on May 19, 2006 (gmt 0)

Can you show me an example? And how do I pass GET values to a url?

macrost




msg:953840
 4:00 am on May 20, 2006 (gmt 0)

Try this:
Set objWinHttp = Server.CreateObject("WinHttp.WinHttpRequest.5")
objWinHttp.Open "GET", url
objWinHttp.Send
strHTML = objWinHttp.ResponseText
Set objWinHttp = Nothing

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved