如果 "http://www.baidu.com/api/api.php?time=".$time."&token=".token 不是你噫造的话,那么请遵守人家的规则
解决方案 »
- 防新浪微博评论功能实现
- 没劲,for help,怎么把一个php网页用程序转成pdf
- 分页问题(我想代表新同学说几句,我们真的很想学会PHP)
- 怎么接收name和age得值
- linux 下配置PHP mysql时,在启动/usr/local/mysql/bin/mysqld_safe &。。。报错Operating system error number 13 in a file operation.
- FMS录制的FLV无法用PHP copy函数复制
- phper新手问题
- php中全局变量传值的问题
- 怎么用PHP接收客户端发送的XML数据?
- 为什么百度搜索几具网站上显示自己的外网IP不一致?
- 企业站用Phonegap转换成手机网站
- apache yii框架配置
$time = time();
$token = md5($key.$time);
$data = file_get_contents("http://www.baidu.com/api/api.php?time=".$time."&token=".$token);
$result = json_decode($data, true);if($result['success']){
echo 'success';
}else{
echo 'fail';
}
api.php$time = isset($_GET['time'])? $_GET['time'] : '';
$token= isset($_GET['token'])? $_GET['token'] : '';
$key = '123456789';//与上面保持一样$ret = array();if(md5($key.$time)==$token){
$ret['success'] = true;
}else{
$ret['success'] = false;
}header('content-type:application/json;charset=utf8');echo json_encode($ret);