PHP socket.io使用笔记

第一步
下载https://github.com/walkor/phpsocket.io/tree/master/docs/zh
解压 上传到服务器
第二步
启动:linux系统cd到到框架目录里运行php start.php start -d。windows系统进入到框架目录里双击start_for_win.bat文件启动。
第三步

  1. HTML页面接收


  1. PHP页面推送
 "publish",
   "content" => "这个是推送的测试数据",
   "to" => $to_uid, 
);
$ch = curl_init ();
curl_setopt ( $ch, CURLOPT_URL, $push_api_url );
curl_setopt ( $ch, CURLOPT_POST, 1 );
curl_setopt ( $ch, CURLOPT_HEADER, 0 );
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt ( $ch, CURLOPT_POSTFIELDS, $post_data );
curl_setopt ($ch, CURLOPT_HTTPHEADER, array("Expect:"));
$return = curl_exec ( $ch );
curl_close ( $ch );
var_export($return);

你可能感兴趣的:(推送)