自己做个小黄鸡玩玩

先上图:

IMG 0005据说接口被封了,不过不要猛用的话还是可以玩的~而且也找到了个备用办法~暂时可以Happy下。虽然是iOS版,不过上段有参考的PHP代码好了
<?php   
//function simsimi($keyword)   
//{   
//做成API接口的话,请发起GET请求,返回Josn   
//只自己用的话,封装成一个函数,返回JSON字段中的response   
  

if(isset($_GET[‘key’])){
$keyword = $_GET[‘key’];
$keyword=rawurlencode($keyword);//添加这句话,解决输入空格引起的的错误
$url = "http://www.simsimi.com/talk.htm?lc=ch";
// echo $url;
//这个curl是因为官方每次请求都有唯一的COOKIE,我们必须先把COOKIE拿出来,不然会一直返回“HI”
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$content = curl_exec($ch);
// echo $content;

curl_close($ch);   
list($header, $body) = explode(&quot;\r\n\r\n&quot;, $content);   

preg_match(&quot;/set\-cookie:([^\r\n]*)/i&quot;, $header, $matches);   
//curl_setopt($ch, CURLOPT_COOKIE, $cookie);   
$cookie = $matches[1];  
// echo $cookie; 
curl_setopt($ch, CURLOPT_COOKIE, $cookie);   
$urll = 'http://www.simsimi.com/func/req?msg=' .$keyword. '&amp;lc=ch';   
 
// 这个CURL就是模拟发起请求咯,直接返回的就是JSON   
$ch = curl_init();   
curl_setopt($ch, CURLOPT_URL, $urll);   
curl_setopt($ch, CURLOPT_HEADER, 0);   
curl_setopt($ch, CURLOPT_REFERER, &quot;http://www.simsimi.com/talk.htm?lc=ch&quot;);   
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);   
curl_setopt($ch, CURLOPT_COOKIE, $cookie);   
$content = curl_exec($ch);   
curl_close($ch);   

//输出json   
//print_r($content);   
// $reply = '你说的话太高深啦,我还听不懂,你可以教教我吗?<a href="http://www.simsimi.com/teach.htm" target="_blank" rel="noopener noreferrer">点这里教我吧~~</a>';   
$reply = '你说的话太高深啦,我还听不懂~';  
$json = json_decode($content, 1);  
if (isset($json['response'])) {  
    $reply = $json['response'];  
}  
echo $reply;  

// }
}
?>