接口发来的数据是没带(-)的,我这只能采集带(-)的,有什么办法能解决啊。
接口商提供的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>