I'll give you a quick rundown:
- Script downloads page from external server using CURL
- CURL writes it to temp.xml
- Use fopen to open temp.xml
- Use fread to read temp.xml
Any reason why this is happening? I've checked temp.
xml, and it has all the content in there. But fread only returns the first 78 characters. Why? It's worked fine in some other scripts. Here's a snippet of code:
- PHP: Select all
function proxy($url) {
$ch = curl_init($url); //CURL URL to temporary file
$fp = @fopen("temp.xml", "w");
curl_setopt($ch, CURLOPT_FILE, $fp); //I have no idea what this does
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
fclose($fp);
$filename = "temp.xml";
$fp = fopen($filename, "r"); //Read temporary file
$content = fread($fp, filesize($filename));
fclose($fp);
return $content;
}