trippin
02-15-2007, 03:53 PM
A lot of people have webhosts which run under SAFE-MODE. Usually, these people don't have access to change this setting and the following functions are disabled for these users..
fopen(), fsockopen(), fwrite(), file(), & file_get_contents()
Most PHP scripts found online are written with one or more of these commands. So we must find an alternate to each command using CURL!
I have found an alternate to a few of these but I need Your help to get the others.
CURL ALTERNATES
file() via PHP
$CONTENTS = file('http://example.com/');
file() via CURL
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, 'http://example.com');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 5);
$data = curl_exec($ch);
curl_close($ch);
$CONTENTS = array();
$CONTENTS = explode("n", $data);
file_get_contents() via PHP
$file_contents = file_get_contents('http://example.com/');
file_get_contents() via CURL
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, 'http://example.com');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 5);
$file_contents = curl_exec($ch);
curl_close($ch);
fopen(), fsockopen(), fwrite(), file(), & file_get_contents()
Most PHP scripts found online are written with one or more of these commands. So we must find an alternate to each command using CURL!
I have found an alternate to a few of these but I need Your help to get the others.
CURL ALTERNATES
file() via PHP
$CONTENTS = file('http://example.com/');
file() via CURL
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, 'http://example.com');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 5);
$data = curl_exec($ch);
curl_close($ch);
$CONTENTS = array();
$CONTENTS = explode("n", $data);
file_get_contents() via PHP
$file_contents = file_get_contents('http://example.com/');
file_get_contents() via CURL
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, 'http://example.com');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 5);
$file_contents = curl_exec($ch);
curl_close($ch);