Reply
Fetch Remote URL using GET
Old 08-07-2008, 08:04 AM Fetch Remote URL using GET
JeremyMiller's Avatar
Full-Time TeraTasker

Posts: 1,470
Name: Jeremy Miller
Location: Marianna, FL
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 - TeraTask
Content Farmer - Automated Posting for Content & Blog Sites
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
 
When You Register, These Ads Go Away!
Old 08-07-2008, 09:49 AM Re: Fetch Remote URL using GET
chrishirst's Avatar
Super Moderator

Posts: 22,281
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!! <<-
Growing old is mandatory - Growing up is optional
Code Samples | People Counting System | Bits & Bobs
chrishirst is online now
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: 102
Location: http://www.isquaretechnologies.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
__________________
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.11711 seconds with 13 queries