/**
* 当客户端发来消息时触发
* @param int $client_id 连接id
* @param mixed $message 具体消息
*/
public static function onMessage($client_id, $message)
{
$HTTP_URL = "http://www.baidu.com/";
$ch = curl_init ();
curl_setopt ( $ch, CURLOPT_URL, $HTTP_URL );
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt ( $ch, CURLOPT_TIMEOUT, 30 );
curl_setopt ( $ch, CURLOPT_SSL_VERIFYPEER, false ); // 这个是重点。
curl_setopt ( $ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)" );
$str = curl_exec ( $ch );
curl_close ( $HTTP_URL );
Gateway::sendToAll($str);
}
请问 大大 是否不支持curl
额,去php手册看看curl用法吧,尤其是curl_close用法。
curl_close ( )函数关闭是的是curl_init()创建的资源句柄......