I was building a content type and trying to assign a "default value" to one of the text fields, using PHP code as a result. My code was doing web automation, and any call to curl_exec() caused the server to give me a 503 error:

Service Temporarily Unavailable

The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

The code block I'm experimenting with, which works just fine on the server's command line, is the following:

$name = urlencode('Darren McGavin');
$url = 'http://www.imdb.com/find?s=nm&q=' . $name;
$ua = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) ";
$ua .= "Gecko/20061204 Firefox/2.0.0.1";
$ch = curl_init($url); 
curl_setopt($ch, CURLOPT_USERAGENT, $ua); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); 
$page = curl_exec($ch);
$value = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
return array(array('value' => $value));

It all works fine until I add that curl_exec() call. Problem is, I need it. :-)

Comments

markus_petrux’s picture

Status: Active » Closed (won't fix)

Well, someone needs to debug what happens in your system when that executes. If you can't, I would suggest posting in the development forums.