I'm installing a script which uses the fopen function, but my host Dreamhost has disabled this feature for security reasons. The suggested alternative was to use CURL, but I'm clueless as to what should I replace the code with.
Here is the part of the code which uses the said function:
Could anybody guide me as to how to replace the fopen, fgets, etc functions with the CURL alternatives? Thanks a lot!
Here is the part of the code which uses the said function:
Code:
$file = fopen($filename, "r");
if (!$file)
{
echo "<p>Unable to open remote file $filename.\n";
}
else
{
while (!feof($file))
{
$var = fgets($file, 1024);
if(eregi("<font color=#008000>(.*)</font><nobr>",$var,$out))
{
$out[1] = strtolower(strip_tags($out[1]));
$s1=str_replace("http://","",$out[1]);
$ur1=str_replace("www.","",$s1);
$s=strpos($ur1," ");
if ($s > 3)$ur1=substr($ur1,0,$s);
$s=strpos($ur1,"/");
if ($s > 3)$ur1=substr($ur1,0,$s);
$ur1=str_replace("/","",$ur1);
$position++;
if($ur==$ur1)
{
$found = $position;
break;
}
}
}
}
fclose($file);
}
Could anybody guide me as to how to replace the fopen, fgets, etc functions with the CURL alternatives? Thanks a lot!





