I have some PHP scripts that deal with fopen on a URL, however dreamhost has disabled fopen commands on URLs due to security reasons but can allow the use of cUrl functions to acheive the same results. Can some point me to a cheatsheet on how to rewrite an fopen call into a cURL call?
Thanks!
Code:
if ($f_cache and //are we caching?
is_readable($cache_file_name) and //file already readable in cache?
$hf=fopen($cache_file_name,'r')) { //can it be opened?
$A=unserialize(fread($hf,filesize($cache_file_name)));
fclose($hf);
}
else {
$mtime1=getmicrotime(); //time before Amazon
if ($hf=fopen($file,'r')) { //else open the file from Amazon
for ($sfile='';$buf=fread($hf,1024);) { //read the complete file (binary safe) 20040715: $sfile='' added
$sfile.=$buf;
}
fclose($hf);
$mtime2=getmicrotime(); //time after Amazon
if ($show_xml) { //print the raw XML?
echo "<pre>\n";
echo htmlentities($sfile); //print the file
echo "</pre>\n";
echo "<hr />\n";
}
Thanks!