Dealing with allow_url_fopen on DreamHost
DreamHost, a pretty popular hosting provider for high-bandwidth sites, is disabling PHP function allow_url_fopen on its servers for security reasons. The change created some disturbance in the WordPress community. So if you ever nbeed to use a PHP require with an external URL, their suggestion is to use CURL instead, wrapping CURL calls inside PHP tags.
<?php
$ch = curl_init();
$timeout = 5; // set to zero for no timeout
curl_setopt ($ch, CURLOPT_URL, ‘http://example.com’);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$file_contents = curl_exec($ch);
curl_close($ch);
echo $file_contents;
?>
September 19th, 2007 at 1:36 am #Genry
так как пользоваться теперь Дримхостом ? если нельзя xml - это наверно изза последнего взлома дримхоста ? Куда вписывать этот код ?