PHP file_get_contents collection is empty. Please give me some advice? ?
环城
环城 2018-06-24 09:47:20
0
3
2116

While debugging a PHP get, please


##[code=php]<?php

$api = 'http://kj. kai861.com/view/pk10.html?1?10001?none?';

$resource = file_get_contents( $api );

$data = json_decode( $resource , 1 );

$ct = $data['c_t'];

$cd = $data['c_d'];

$cr = $data['c_r'] ;

header('Content-Type: text/xml;charset=utf8');

$limit=strlen($ct)-3;

$ct= substr($ct,0,$limit).''.substr($ct,$limit,$limit 3);


## function tmp($v){

return 10>$v?"0{$v}":$v;

}

$cr=implode(',',array_map('tmp', array_slice(explode(',',$cr),0,20)));

echo '<xml>

<row expect="'.$ct.'" opencode="'.$cr.'" opentime="'.str_replace('/','-',$cd).'"/>

</xml>';[/code ]



Directly open http://kj.kai861.com/view/pk10.html?1?10001?none? Normal


Thanks

环城
环城

reply all(3)
小さな手は

The API should be this: http://api.api68.com/pks/getLotteryPksInfo.do?lotCode=10001

  • reply How did you get this address? This is in JSON format and can be used
    环城 author 2018-06-24 16:10:49
小さな手は

I don’t know what you want to get, but file_get_contents( $api ); returns HTML, not JSON, so this json_decode must be wrong.

环城

Is there an easy way to obtain dynamic data generated by JS?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template