For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > April 2004 > URL Problem









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author URL Problem
Chris Payne

2004-04-21, 1:33 pm

Hi there everyone,



I have a problem. Basically this is what I need to do:



Request behind the scenes (PHP) an ASP Url on a different website with the
value pid=11111 (Where 11111 is an identifying number). Then I need PHP to
listen to the response from that request as ASP will then return a value
which PHP has to pickup, and I have ZERO idea how to do this :-( I tried
something which I though, but that gets the webpage and NOT the url that it
passes back with it’s values.



Any help would be greatly appreciated.



So basically I need to request an URL from within PHP, PHP listens to and
gets the reply URL that is sent back to it with the new value (Which is
determined by the pid= value).



Thank you everyone.



Chris


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.662 / Virus Database: 425 - Release Date: 4/20/2004


Justin Patrin

2004-04-21, 2:38 pm

Chris Payne wrote:

> Hi there everyone,
>
>
>
> I have a problem. Basically this is what I need to do:
>
>
>
> Request behind the scenes (PHP) an ASP Url on a different website with the
> value pid=11111 (Where 11111 is an identifying number). Then I need PHP to
> listen to the response from that request as ASP will then return a value
> which PHP has to pickup, and I have ZERO idea how to do this :-( I tried
> something which I though, but that gets the webpage and NOT the url that it
> passes back with it’s values.
>
>
>
> Any help would be greatly appreciated.
>
>
>
> So basically I need to request an URL from within PHP, PHP listens to and
> gets the reply URL that is sent back to it with the new value (Which is
> determined by the pid= value).
>
>
>
> Thank you everyone.
>
>
>
> Chris
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.662 / Virus Database: 425 - Release Date: 4/20/2004
>
>


You could use PEAR's HTTP_Request and just grab the resulting URL from it.

require_once('HTTP/Request.php');
$req = new HTTP_Request('http://example.com/somescript.asp?pid=11111',
array('allowRedirects' => true));
$req->sendRequest();
$url = $req->_url;

That *should* do it.

--
paperCrane <Justin Patrin>
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com