extern.php,Dreamhost,curl
我的论坛是用的punbb导入数据以后,发现在其它页面要显示最新帖子的代码不行了,错误如下:Warning: include() [function.include]: URL file-access is disabled in the server configuration in /home/.freight/topcool/blog.manboo.info/wp-content/themes/manboo/sidebar.php on line 351原来下面这句话已经不能用了:
<?php
include(’http://forums.manboo.info/extern.php?action=active’);
?>
原因是Dreamhost将allow_url_fopen设为off了。到punbb和google搜索了下,解决方法是使用$curl用下面的代码,注意根据情况修改红色那句。
<?php
$curl_handle = curl_init();
// Where should we get the data?
curl_setopt ($curl_handle, CURLOPT_URL, ‘http://forums.manboo.info/extern.php?action=active’);
// This says not to dump it directly to the output stream, but instead
// have it return as a string.
curl_setopt ($curl_handle, CURLOPT_RETURNTRANSFER, 1);
// the following is optional, but you should [...]
Popularity: 42% [?]


