如果你下载下来了,你一定要善待这只鸡。下载下来打开就可以聊天!我放到了我的服务器上,国庆期间我无聊就找鸡。
http://www.wbaobao.top/talkJJ/
代码核心就是调用接口跟前台的输出js的使用方法。
它可能没有你想象的那么黄,最黄的在韩国。<?php <br />
namespace Home\Controller;<br>
use Think\Controller;<br>
class IndexController extends Controller {<br>
public function index(){<br>
$this->display();<br>
}<br>
public function data(){<br>
if (IS_POST) {<br>
$appkey = "5e70fea5553d2deea473c13b516a564a";<br>
$url = "http://op.juhe.cn/robot/index";<br>
$metock=I("post.txt","haha");<br>
$params = array(<br>
"key" => $appkey,//您申请到的本接口专用的APPKEY<br>
"info" => $metock,//要发送给机器人的内容,不要超过30个字符<br>
"dtype" => "",//返回的数据的格式,json或xml,默认为json<br>
"loc" => "",//地点,如北京中关村<br>
"lon" => "",//经度,东经116.234632(小数点后保留6位),需要写为116234632<br>
"lat" => "",//纬度,北纬40.234632(小数点后保留6位),需要写为40234632<br>
"userid" => "",//1~32位,此userid针对您自己的每一个用户,用于上下文的关联<br>
);<br>
$params=http_build_query($params);<br>
$ispost=0;<br>
$httpInfo = array();<br>
$ch = curl_init();<br>
curl_setopt( $ch, CURLOPT_HTTP_VERSION , CURL_HTTP_VERSION_1_1 );<br>
curl_setopt( $ch, CURLOPT_USERAGENT , 'JuheData' );<br>
curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT , 60 );<br>
curl_setopt( $ch, CURLOPT_TIMEOUT , 60);<br>
curl_setopt( $ch, CURLOPT_RETURNTRANSFER , true );<br>
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);<br>
curl_setopt( $ch , CURLOPT_URL , $url.'?'.$params );<br>
$response = curl_exec( $ch );<br>
if ($response === FALSE) {<br>
return false;<br>
}<br>
$httpCode = curl_getinfo( $ch , CURLINFO_HTTP_CODE );<br>
$httpInfo = array_merge( $httpInfo , curl_getinfo( $ch ) );<br>
curl_close( $ch );<br>
$data=json_decode($response,ture)["result"]["text"];<br>
$return=[<br>
"text"=>$data,<br>
];<br>
$this->ajaxReturn($return);<br>
}<br>
}<br>
}
talkJJ.rar ( 1.25 MB 下载:63 次 )