首页 > 代码库 > PHP通过接口形式传输xml数据
PHP通过接口形式传输xml数据
这里的接口通过传递参数请求数据:
请求形式: xxx.php?data=http://www.mamicode.com/20140101&page=1
参数说明:data表示请求数据的日期
page表示请求的页数
<?php header("Content-type: text/xml;charset=utf-8"); date_default_timezone_set(‘PRC‘); include dirname(__FILE__)."/../../../Inc/mysql.php"; $link = mysql_connect($f_serverName,$f_userName,$f_password); $d = mysql_select_db($f_htNewsDate,$link) or die("服务器内部故障,请联系客服!!!"); mysql_query(‘set names utf8‘); $data = $_GET[‘data‘]; $page = $_GET[‘page‘]; $list = 200; $time = strtotime($data); $top = array( ‘189‘ => ‘国家‘, ‘1854‘ => ‘安徽‘, ‘1831‘ => ‘北京‘, ‘1899‘ => ‘重庆‘, ‘1877‘ => ‘福建‘, //A-F ‘1882‘ => ‘甘肃‘, ‘1891‘ => ‘广东‘, ‘1843‘ => ‘广西‘, ‘1870‘ => ‘贵州‘, //G ‘1879‘ => ‘海南‘, ‘1858‘ => ‘河北‘, ‘1849‘ => ‘河南‘, ‘1890‘ => ‘湖北‘, ‘1866‘ => ‘湖南‘, ‘1864‘ => ‘黑龙江‘, //H ‘1857‘ => ‘吉林‘, ‘1855‘ => ‘江苏‘, ‘1893‘ => ‘江西‘, ‘1845‘ => ‘辽宁‘, ‘1897‘ => ‘宁夏‘, ‘1892‘ => ‘内蒙古‘, //J-N ‘1873‘ => ‘青海‘, ‘1883‘ => ‘上海‘, ‘1840‘ => ‘山东‘, ‘1862‘ => ‘山西‘, ‘1874‘ => ‘陕西‘, ‘1887‘ => ‘四川‘, //Q-S ‘1839‘ => ‘天津‘, ‘1884‘ => ‘西藏‘, ‘1868‘ => ‘新疆‘, ‘1865‘ => ‘云南‘, ‘1851‘ => ‘浙江‘, //T-Z ‘1993‘ => ‘资讯‘, ‘2043‘ => ‘新闻‘, ); foreach($top as $key=>$value){ $arr[]=$key; } $arr=implode(‘,‘,$arr); $limit = ($page-1) * $list; $sql ="select id,typeid,title,filename,senddate as pubdate from dede_archives WHERE arcrank=0 AND (flag like ‘%h%‘ OR flag like ‘%c%‘) AND senddate>=‘1388505600‘ AND pubdate>=‘$time‘ AND typeid in ($arr) ORDER BY pubdate DESC limit $limit,$list"; $result=mysql_query($sql); $data=http://www.mamicode.com/array();>
PHP通过接口形式传输xml数据
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。