Re: url extracting
| From: | Matt McClanahan | Date: | Mon, 12 Nov 2001 17:45:09 +0000 |
| Subject: | Re: url extracting | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-74313@lists.php.net to get a copy of this message | ||
On Mon, Nov 12, 2001 at 04:42:08PM -0000, Caspar Kennerdale wrote:
> I am yrying to read free urls from a moreover.com to a director app which
> will be a news reader without a browser
>
> 'm using php top extrat the headlines
>
> each headline looks similar to this
>
> ("http://c.moreover.com/click/here.pl?l27536670")
>
>
> If a browser goes to this page then it is redirected to the appropriate page
> ie www.newssite.com/etc/etc/etc
>
> Director does not interpret the redirection.
>
> Can anyone think of a way for a script to go the to the moreover link and
> then return the 'real url as a variable or as an array of links (if multiple
> headlines are required
You can open a socket to the web server with PHP and grab the Location
header from the response.
See the fsockopen() man page for examples, or sendtohost.txt for a
simple function to handle passing the right headers.
http://www.php.net/manual/en/function.fsockopen.php
http://dodds.net/~cardinal/sendtohost.txt
Matt