yaonewnew 发表于 1-11 14:35

百度度小秘API接口及PHP事例源码

以下是个人实验成功的PHP源码
<?php
$msg=urlencode('你几岁了?');
//内容
$url = "https://sp0.baidu.com/yLsHczq6KgQFm2e88IuM_a/s?sample_name=bear_brain&request_query='.$msg.'&bear_type=1";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIE, 'BDUSS=你的bduss');
$content = curl_exec($ch);
curl_close($ch);
$content=json_decode($content);
//print_r($content);

$content=$content->result_list->result_content;
//print_r($content);
$content=json_decode($content);
//print_r($content);
$content=$content=$content->answer;
$content=str_replace("小度","滑小稽",$content);
$content=str_replace("<AGE>","21",$content);
echo $content;

fc兵兵 发表于 1-12 02:12

看到开源的东西我就是要赞,先不管我看不看得懂!

恩恩是我 发表于 1-28 00:25

感谢楼主感谢楼主

dhhd121 发表于 2-15 01:58

感谢楼主感谢楼主!

丁丁 发表于 2-15 17:20


感谢楼主感谢楼主!

丁丁 发表于 2-15 17:30

表示用不了,直接get和post都是{"msg":"backend empty","status":-2}
页: [1]
查看完整版本: 百度度小秘API接口及PHP事例源码