WordPress and File Get-Contents
Posted by: Scoop
Posted on: 2008-05-25 21:12:00
Yes, I don't know PHP, so I'm sure that's the first problem. heh.. I'm trying to use a simple PHP script to pull in some content from another site of mine, and I've learned that Dreamhost prevents this command, and recommends using Curl (whatever that is!).
So I did that, but everytime I add the line of code, and update my template, I get an error that says:
Service Temporarily Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
And when I remove the code, or add anything OTHER than this code, it works fine. So every time I add the code, it's a prob. Here's the code I'm using, as recommended via Dreamhost:
<?php
$ch = curl_init();
$timeout = 5; // set to zero for no timeout
curl_setopt ($ch, CURLOPT_URL, 'http://www.example.com');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$file_contents = curl_exec($ch);
curl_close($ch);
// display file
echo $file_contents;
?>
Weird. Any help?