In reply to:
I would like to expand on this as I think it is related.
See the documentation at curl_setopt -- Set an option for a CURL transfer
CURLOPT_FOLLOWLOCATION
TRUE to follow any "Location: " header that the server sends as part of the HTTP header (note this is recursive, PHP will follow as many "Location: " headers that it is sent, unless CURLOPT_MAXREDIRS is set).
Perl / MySQL / HTML+CSS