头大啊,一个(-)符号要把人整死了,求大神帮下

a8849516 2017-06-05 10:51:36


接口发来的数据是没带(-)的,我这只能采集带(-)的,有什么办法能解决啊。



接口商提供的PHP演示可以显示成这样,可是没法采集啊
<?php header("Content-type: text/html; charset=utf-8"); ?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf8" />
<meta http-equiv="refresh" content="5">
</head>
<body>
<?php
echo '<br>';
$src = 'http://f.apiplus.cn/cqssc.xml';
echo '<br>采集地址:'.$src.'<br>';
$src .= '?_='.time();
$xml = file_get_contents(urldecode($src));
$xml = simplexml_load_string($xml);

echo "<br>".date('Y-m-d H:i:s')."共采集到{$xml->attributes()->rows}行开奖数据:<br>";
for ($i = 0; $i < count($xml->row); $i++) {
$p = $xml ->row[$i]->attributes()->expect;
echo '<br>开奖期号:'.substr($p,0,8).'-'.substr($p,-3,3);
echo '<br>开奖号码:'.$xml ->row[$i]->attributes()->opencode;
echo '<br>开奖时间:'.$xml ->row[$i]->attributes()->opentime;
echo '<br>';
}
?>
</body>
</html>
...全文
158 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
a8849516 2017-06-05
  • 打赏
  • 举报
回复
100r有偿求助啊,我看别人就是采集了又写成适和自己采集的格式的接口再采集

8,906

社区成员

发帖
与我相关
我的任务
社区描述
XML/XSL相关问题讨论专区
社区管理员
  • XML/XSL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧