Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Fetch Remote URL using GET
Old 08-07-2008, 08:04 AM Fetch Remote URL using GET
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
Trades: 0
I have a client who is, unfortunately, using a server which I need to do a little bit of work on and which cannot run PHP b/c of some Microsoft crap, so I'm hoping you all can help me here. Well, actually, I'm confident you all can.

So, on with what I'm trying to do: I have a form which submits a code via POST and have figured out enough ASP to retrieve the posted code. I now need to send the code behind the scenes to his PHP server where I do most of the work. The URL will be of the form www.somedomain.com/index.php?code=ABC except that I want to hash the value of code. The PHP script will return "yes" or "no". I just need something that will call the URL and allow me to access what it returns. In pseudo-code, here is what I'd like it to do:

Code:
IF 
  (code is set) 
THEN
  hashed_code = hash(entered_code + "random garbage)
  returned_code = FETCH(www.somedomain.com/index.php?code=hashed_code)
  IF
    (returned_code == "yes")
  THEN
    redirect user to another page
  ELSE
    ECHO error notice
  END IF
END IF
TK, of course, for any and all help. And, yes, I obviously don't know ASP and I have no intention of learning it. Just stuck in a situation where I need this one little script and after a bit of searching around the web have decided that it's best if I just ask for guidance.

Again, thanks in advance!
__________________
Jeremy Miller

Please login or register to view this content. Registration is FREE
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
 
Register now for full access!
Old 08-07-2008, 09:49 AM Re: Fetch Remote URL using GET
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,515
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
One of my spider functions to grab the page source code from a remote URI
Code:
const strUserAgent = "Make a user agent string to identify it"
dim strURL

strURL = request("url")

 Response.Buffer = True
  Dim objXMLHTTP, xml
  Set xml = Server.CreateObject("Microsoft.XMLHTTP")
  
 	xml.Open "GET", strURL, False
	xml.setRequestHeader "User-Agent", strUserAgent '  
	xml.Send
	if xml.status = 200 then
	response.write xml.responseText
	else
	response.write cstr(xml.status) & " (" & xml.StatusText & ")"
	end if
  Set xml = Nothing
Put this on an ASP page, call the page from PHP sending the URL as a GET or POST and it will return the source code from the URL
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 08-11-2008, 08:36 AM Re: Fetch Remote URL using GET
Super Talker

Posts: 104
Location: http://www.joomladevs.com
Trades: 0
Quote:
Originally Posted by chrishirst View Post
One of my spider functions to grab the page source code from a remote URI
Code:
const strUserAgent = "Make a user agent string to identify it"
dim strURL

strURL = request("url")

 Response.Buffer = True
  Dim objXMLHTTP, xml
  Set xml = Server.CreateObject("Microsoft.XMLHTTP")
  
 	xml.Open "GET", strURL, False
	xml.setRequestHeader "User-Agent", strUserAgent '  
	xml.Send
	if xml.status = 200 then
	response.write xml.responseText
	else
	response.write cstr(xml.status) & " (" & xml.StatusText & ")"
	end if
  Set xml = Nothing
Put this on an ASP page, call the page from PHP sending the URL as a GET or POST and it will return the source code from the URL
Yes this is the perfect way to get the source code but make sure that you have XMLHTTP component installed on the server
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE


saurabhj is offline
Reply With Quote
View Public Profile Visit saurabhj's homepage!
 
Reply     « Reply to Fetch Remote URL using GET
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.36397 seconds with 12 queries