Making Curl Work with Linkman for Allow_URL_fopen

Making Curl Work with Linkman for Allow_URL_fopen

Posted by: Aletheides
Posted on: 2008-09-09 14:41:00

Hi I'm trying to edit linkman so it works with CURL instead of going through the tedious task of allowing url_fopen on all of my sites.

I understand there's an alternative for get_file_contents: http://wiki.dreamhost.com/index.php/CURL#Alternative_for_file_get_contents.28.29

But how would you edit the script so it uses this alternative?

Re: Making Curl Work with Linkman for Allow_URL_fopen

Posted by: scjessey
Posted on: 2008-09-10 12:21:00

In theory, all you would need to do is replace this line:

$html = @file_get_contents($recurl) or problem('Can\'t open remote URL!');

with this:

$ch = curl_init();
$timeout = 5; // set to zero for no timeout
curl_setopt ($ch, CURLOPT_URL, $recurl);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$html = curl_exec($ch);
curl_close($ch);


-- si-blog --

Re: Making Curl Work with Linkman for Allow_URL_fopen

Posted by: Aletheides
Posted on: 2008-09-12 00:28:00

Thanks for the reply, unfortunately it didn't work for me :(

Any other suggestions would be appreciated.

Best regards,
Al

Re: Making Curl Work with Linkman for Allow_URL_fopen

Posted by: scjessey
Posted on: 2008-09-12 12:37:00

In that case, I recommend contacting the developers.

-- si-blog --

Tags: fopen