Date: Fri, 23 Dec 2005 10:04:16 +0000
From: Yemi Obembe <[EMAIL PROTECTED]>
Subject: using fsockopen to handle redirections

Any way i can use fsockopen to detect url redirections? for example if ds: redirects to and i'm using:

$fp = fsockopen(, 80)

to connect to the site, anyway i can know if there is a redirection to
another url?

Probably rather than fsockopen it would be helpful to use the CURL library to make the connection(s). You should install the CURL extension to PHP, more information at and (^Find : CURLOPT_FOLLOWLOCATION)

This page contains useful discussion about that. Basically you'll want to set CURLOPT_FOLLOWLOCATION which will allow CURL to respond to the redirect header as if it was a browser.

If you're not using CURL then you've got significant extra work to look at each individual header sent by the redirecting web server to determine which header is the redirect and which location it's sending you to (probably using a regex).

Cheers - Neil

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to