基于php的万年历接口调用代码实例.doc

上传人:夏** 文档编号:559787279 上传时间:2023-11-07 格式:DOC 页数:4 大小:134KB
返回 下载 相关 举报
基于php的万年历接口调用代码实例.doc_第1页
第1页 / 共4页
基于php的万年历接口调用代码实例.doc_第2页
第2页 / 共4页
基于php的万年历接口调用代码实例.doc_第3页
第3页 / 共4页
基于php的万年历接口调用代码实例.doc_第4页
第4页 / 共4页
亲,该文档总共4页,全部预览完了,如果喜欢就下载吧!
资源描述

《基于php的万年历接口调用代码实例.doc》由会员分享,可在线阅读,更多相关《基于php的万年历接口调用代码实例.doc(4页珍藏版)》请在金锄头文库上搜索。

1、基于php的万年历接口调用代码实例代码描述:基于php的万年历接口调用代码实例代码平台:聚合数据?php/ +-/ | JuhePHP NO ZUO NO DIE / +-/ | Copyright (c) 2010-2015 http:/ All rights reserved./ +-/ | Author: Juhedata / +-/-/ 万年历调用示例代码 聚合数据/ 在线接口文档:http:/ = *;/*1.获取当天的详细信息*$url = http:/ = array(key = $appkey,/您申请的appKeydate = ,/指定日期,格式为YYYY-MM-DD,如月份

2、和日期小于10,则取个位,如:2012-1-1);$paramstring = http_build_query($params);$content = juhecurl($url,$paramstring);$result = json_decode($content,true);if($result)if($resulterror_code=0)print_r($result);elseecho $resulterror_code.:.$resultreason;elseecho 请求失败;/*/*2.获取当月近期假期*$url = http:/ = array(key = $appkey

3、,/您申请的appKeyyear-month = ,/指定月份,格式为YYYY-MM,如月份和日期小于10,则取个位,如:2012-1);$paramstring = http_build_query($params);$content = juhecurl($url,$paramstring);$result = json_decode($content,true);if($result)if($resulterror_code=0)print_r($result);elseecho $resulterror_code.:.$resultreason;elseecho 请求失败;/*/*3.

4、获取当年的假期列表*$url = http:/ = array(key = $appkey,/您申请的appKeyyear = ,/指定年份,格式为YYYY,如:2015);$paramstring = http_build_query($params);$content = juhecurl($url,$paramstring);$result = json_decode($content,true);if($result)if($resulterror_code=0)print_r($result);elseecho $resulterror_code.:.$resultreason;el

5、seecho 请求失败;/*/* 请求接口返回内容* param string $url 请求的URL地址* param string $params 请求的参数* param int $ipost 是否采用POST形式* return string*/function juhecurl($url,$params=false,$ispost=0)$httpInfo = array();$ch = curl_init();curl_setopt( $ch, CURLOPT_HTTP_VERSION , CURL_HTTP_VERSION_1_1 );curl_setopt( $ch, CURLO

6、PT_USERAGENT , JuheData );curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT , 60 );curl_setopt( $ch, CURLOPT_TIMEOUT , 60);curl_setopt( $ch, CURLOPT_RETURNTRANSFER , true );curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);if( $ispost )curl_setopt( $ch , CURLOPT_POST , true );curl_setopt( $ch , CURLOPT_POSTFIEL

7、DS , $params );curl_setopt( $ch , CURLOPT_URL , $url );elseif($params)curl_setopt( $ch , CURLOPT_URL , $url.?.$params );elsecurl_setopt( $ch , CURLOPT_URL , $url);$response = curl_exec( $ch );if ($response = FALSE) /echo cURL Error: . curl_error($ch);return false;$httpCode = curl_getinfo( $ch , CURLINFO_HTTP_CODE );$httpInfo = array_merge( $httpInfo , curl_getinfo( $ch ) );curl_close( $ch );return $response;

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 生活休闲 > 社会民生

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号