头大啊,一个(-)符号搞得人要跪了,求大神帮下

头大啊,一个(-)符号搞得人要跪了,求大神帮下0
头大啊,一个(-)符号搞得人要跪了,求大神帮下1

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

接口商提供的php演示能显示成这样,可是又没法采集

头大啊,一个(-)符号搞得人要跪了,求大神帮下2

row); $i++) {

$p = $xml ->row[$i]->attributes()->expect;

echo ‘开奖期号:’.substr($p,0,8).’-‘.substr($p,-3,3);

echo ‘开奖号码:’.$xml ->row[$i]->attributes()->opencode;

echo ‘开奖时间:’.$xml ->row[$i]->attributes()->opentime;

echo ”;

}

?>

回复讨论(解决方案)

什么意思?

那个 – 是 xml 浏览工具附加的,用于折叠显示 xml 文档

2170605-062 这里面这个(-)

我用的接口是显示2170605062

采集的内容少了一个(-),导致出问题

头大啊,一个(-)符号搞得人要跪了,求大神帮下3
头大啊,一个(-)符号搞得人要跪了,求大神帮下4

大神来帮帮啊,解决了给红包啊

他原来就那样,你得自己处理一下
$src = ‘http://f.apiplus.cn/cqssc.xml’;
$xml = file_get_contents(urldecode($src));
$xml = simplexml_load_string($xml);
foreach($xml->row as $r) {
foreach($r->attributes() as $k=>$v) {
if($k == “expect”) $v = join(“-“, str_split($v, 8));
echo “$k => $v\n”;
}
}

expect => 20170606-040
opencode => 9,6,8,6,0
opentime => 2017-06-06 12:40:40
expect => 20170606-039
opencode => 3,5,7,8,1
opentime => 2017-06-06 12:30:40
expect => 20170606-038
opencode => 6,8,6,7,3
opentime => 2017-06-06 12:20:40
expect => 20170606-037
opencode => 5,9,8,2,4
opentime => 2017-06-06 12:10:40
expect => 20170606-036
opencode => 8,9,3,4,4
opentime => 2017-06-06 12:00:40

{ //

title:’16’, //

source:’16’, //

name:’cqssc’, //

enable:true, //

timer:’cqssc’, //

option:{ //

host:”f.apiplus.net”, //

timeout:50000, //

path: ‘/cqssc.xml’, //

headers:{ //

“user-agent”: “mozilla/4.0 (compatible; msie 8.0; windows nt 6.0) ” //

} //

}, //

parse:function(str){ //

try{ //

str=str.substr(0,200); //

var reg=/row as $r) {

foreach($r->attributes() as $k=>$v) {

if($k == “expect”) $v = join(“-“, str_split($v, 8));

echo “$k => $v\n”;

}

}

显示不对。。代码改怎么该呢

你主贴的代码(去掉 $src .= ‘?_=’.time();)得到

采集地址:http://f.apiplus.cn/cqssc.xml
2017-06-06 13:35:12共采集到5行开奖数据:
开奖期号:20170606-043
开奖号码:9,8,5,5,9
开奖时间:2017-06-06 13:10:40
开奖期号:20170606-042
开奖号码:9,0,8,1,4
开奖时间:2017-06-06 13:00:40
开奖期号:20170606-041
开奖号码:0,5,3,5,7
开奖时间:2017-06-06 12:50:40
开奖期号:20170606-040
开奖号码:9,6,8,6,0
开奖时间:2017-06-06 12:40:40
开奖期号:20170606-039
开奖号码:3,5,7,8,1
开奖时间:2017-06-06 12:30:40有什么不对吗?

哦,是我没说明白,我是用node采集的
头大啊,一个(-)符号搞得人要跪了,求大神帮下5

他只能采集
头大啊,一个(-)符号搞得人要跪了,求大神帮下6这样的xml格式啊

头大啊,一个(-)符号搞得人要跪了,求大神帮下7 这样的没法采集啊

哪个好心的大神帮处理下啊

attribute() as $k=>$v){
if($k==”expect”){
$v=join(“-“,str_split($v,8));
}
echo $k.$v.””;
}
}
?>

把这个网页的内容
头大啊,一个(-)符号搞得人要跪了,求大神帮下8

像这个类型
头大啊,一个(-)符号搞得人要跪了,求大神帮下9传输出来

或者在采集袋面里改一下把采集到的内容中间加个(-)

option:{ //

host:”f.apiplus.net”, //

timeout:50000, //

path: ‘/cqssc.xml’, //

headers:{ //

“user-agent”: “mozilla/4.0 (compatible; msie 8.0; windows nt 6.0) ” //

} //

}, //

parse:function(str){ //

try{ //

str=str.substr(0,200); //

var reg=/row); $i < $count; $i++) { $p = $xml->row[$i]->attributes()->expect;
$tmp = array(
‘expect’ => substr($p,0,8).’-‘.substr($p,-3,3),//开奖期号
‘opencode’ => current($xml->row[$i]->attributes()->opencode),//开奖号码
‘opentime’ => current($xml->row[$i]->attributes()->opentime),//开奖时间
);
$data[] = $tmp;
}
$json = json_encode($data);
echo ‘json 格式’;
echo $json;
echo ”;
echo ‘数组格式:’;
echo “”;
print_r(json_decode($json,true));
echo “”;
/*
json 格式
[{“expect”:”20170606-060″,”opencode”:”4,3,6,7,2″,”opentime”:”2017-06-06 16:00:40″},{“expect”:”20170606-059″,”opencode”:”1,3,6,6,4″,”opentime”:”2017-06-06 15:50:40″},{“expect”:”20170606-058″,”opencode”:”9,1,7,4,9″,”opentime”:”2017-06-06 15:40:40″},{“expect”:”20170606-057″,”opencode”:”4,5,6,0,1″,”opentime”:”2017-06-06 15:30:40″},{“expect”:”20170606-056″,”opencode”:”1,8,0,1,3″,”opentime”:”2017-06-06 15:20:40″}]
数组格式:
array
(
[0] => array
(
[expect] => 20170606-060
[opencode] => 4,3,6,7,2
[opentime] => 2017-06-06 16:00:40
)
[1] => array
(
[expect] => 20170606-059
[opencode] => 1,3,6,6,4
[opentime] => 2017-06-06 15:50:40
)
[2] => array
(
[expect] => 20170606-058
[opencode] => 9,1,7,4,9
[opentime] => 2017-06-06 15:40:40
)
[3] => array
(
[expect] => 20170606-057
[opencode] => 4,5,6,0,1
[opentime] => 2017-06-06 15:30:40
)
[4] => array
(
[expect] => 20170606-056
[opencode] => 1,8,0,1,3
[opentime] => 2017-06-06 15:20:40
)
)
*/

做成xml好么

$src = ‘http://f.apiplus.cn/cqssc.xml’;

$src .= ‘?_=’.time();

$xml = file_get_contents(urldecode($src));

$xml = simplexml_load_string($xml);

$data = array();

for ($i = 0,$count = count($xml->row); $i < $count; $i++) { $p = $xml->row[$i]->attributes()->expect;

$tmp = array(

‘expect’ => substr($p,0,8).’-‘.substr($p,-3,3),//开奖期号

‘opencode’ => current($xml->row[$i]->attributes()->opencode),//开奖号码

‘opentime’ => current($xml->row[$i]->attributes()->opentime),//开奖时间

);

$data[] = $tmp;

}

$json = json_encode($data);

echo ‘json 格式’;

echo $json;

echo ”;

echo ‘数组格式:’;

echo “”;

print_r(json_decode($json,true));

echo “”;

/*

json 格式

[{“expect”:”20170606-060″,”opencode”:”4,3,6,7,2″,”opentime”:”2017-06-06 16:00:40″},{“expect”:”20170606-059″,”opencode”:”1,3,6,6,4″,”opentime”:”2017-06-06 15:50:40″},{“expect”:”20170606-058″,”opencode”:”9,1,7,4,9″,”opentime”:”2017-06-06 15:40:40″},{“expect”:”20170606-057″,”opencode”:”4,5,6,0,1″,”opentime”:”2017-06-06 15:30:40″},{“expect”:”20170606-056″,”opencode”:”1,8,0,1,3″,”opentime”:”2017-06-06 15:20:40″}]

数组格式:

array

(

[0] => array

(

[expect] => 20170606-060

[opencode] => 4,3,6,7,2

[opentime] => 2017-06-06 16:00:40

)

[1] => array

(

[expect] => 20170606-059

[opencode] => 1,3,6,6,4

[opentime] => 2017-06-06 15:50:40

)

[2] => array

(

[expect] => 20170606-058

[opencode] => 9,1,7,4,9

[opentime] => 2017-06-06 15:40:40

)

[3] => array

(

[expect] => 20170606-057

[opencode] => 4,5,6,0,1

[opentime] => 2017-06-06 15:30:40

)

[4] => array

(

[expect] => 20170606-056

[opencode] => 1,8,0,1,3

[opentime] => 2017-06-06 15:20:40

)

)

*/

这个代码貌似不采集啊

小哥哥,你的

var reg=/120) actionno=120;

var conf=createtimeprocess();

if(actionno>=120) actionno=1;

var d=conf[actionno-1].split(‘:’);

var date=new date();

var time=date.gettime();

var delay=10000;

date.setseconds(0);

date.sethours(d[0]);

date.setminutes(d[1]);

return 10000; //

Posted in 未分类