What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » [Solved] CURLOPT_FOLLOWLOCATION not working correctly on Dreamhost?

[Solved] CURLOPT_FOLLOWLOCATION not working correctly on Dreamhost?
Author: Message:
Mike
Elite Member
*****

Avatar
Meet the Spam Family!

Posts: 2795
Reputation: 48
32 / Male / Flag
Joined: Mar 2003
Status: Online
O.P. [Solved] CURLOPT_FOLLOWLOCATION not working correctly on Dreamhost?
Hey, I have the following code which gets returns the headers of a website:

php code:
function head($url)
{
    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_HEADER, true);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_MAXREDIRS, 7);
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1");
    curl_setopt($ch, CURLOPT_NOBODY, true);   

   
    $output = curl_exec($ch);
    // check for errors
    if (curl_errno($ch))
    {
        echo curl_error($ch);
        $output = false;
    }
    curl_close($ch);
    return $output;
}

This works perfectly on my local server, but when I upload it to Dreamhost, it only returns the headers for the first website, and does not follow the location header (EDIT: the first headers are only shown if I add a [font=courier]echo $output; after the curl_exec line). It also throws this error:
quote:
Originally posted by curl
transfer closed with outstanding read data remaining

Does anyone know what's going on?

Thanks :)

Sorry for the lack of information. I'm in a hurry now!

This post was edited on 11-09-2009 at 05:54 AM by Mike.
YouTube closed-captions ripper (also allows you to download videos!)
11-08-2009 07:01 AM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
[Solved] CURLOPT_FOLLOWLOCATION not working correctly on Dreamhost? - by Mike on 11-08-2009 at 07:01 AM
RE: CURLOPT_FOLLOWLOCATION not working correctly on Dreamhost? - by Vilkku on 11-08-2009 at 09:59 AM
RE: CURLOPT_FOLLOWLOCATION not working correctly on Dreamhost? - by Mike on 11-08-2009 at 01:33 PM
RE: CURLOPT_FOLLOWLOCATION not working correctly on Dreamhost? - by WDZ on 11-08-2009 at 10:40 PM
RE: CURLOPT_FOLLOWLOCATION not working correctly on Dreamhost? - by Mike on 11-09-2009 at 12:40 AM
RE: CURLOPT_FOLLOWLOCATION not working correctly on Dreamhost? - by WDZ on 11-09-2009 at 03:13 AM
RE: CURLOPT_FOLLOWLOCATION not working correctly on Dreamhost? - by Mike on 11-09-2009 at 05:53 AM
RE: [Solved] CURLOPT_FOLLOWLOCATION not working correctly on Dreamhost? - by WDZ on 11-09-2009 at 06:22 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On