Hi,

On 4 February 2011 11:32, Bruce Clement <[email protected]> wrote:
> Hi,
>
> I want to do the following
>
> 1 Start with a URL to a redirecting service (e.g. goo.gl, bit.ly) or even
> just a page that redirects to another page on the same site
> 2 Retrieve the page,

do you really need this page?

if not, you can just use curl_setopt($ch, CURLOPT_FOLLOWLOCATION,true);


if you need the page, you need to
- turn on curl_setopt($rch, CURLOPT_HEADER, true);
curl_setopt($rch, CURLOPT_RETURNTRANSFER, true);
- parse for the header in what is returned by curl
- set the curl url to the header locations and repeat until there is
no header anymore.
- You also need to cover infinite loops somehow

> 3 Extract the 30x header & substitute for the original URL
> 4 Repeat until you no longer receive a 30x response.

The above solutions gives  up if curl_setopt($ch, CURLOPT_MAXREDIRS,
$number); is reached.

See here:

http://www.php.net/manual/en/function.curl-setopt.php

-- 
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]

Reply via email to