本帖最后由 xiachao2008 于 2011-10-25 23:48:06 编辑

解决方案 »

  1.   

    链接的到的不是数组,是json
    $content  = file_get_contents("http://data.dianxin.cn/apiCount.php?key=jsdfjsdkue&uid=100018&date=2011-10-09");
    $arr = json_decode($content,true);
      

  2.   

    本来我是想用GETJSON连的,但是怎么都连不起,没有办法,只有用采集的办法了,
    你的这个方法我试了,不行。
      

  3.   

    <?php$cookie_jar = tempnam('./tmp','cookie');
    $ch=curl_init();
    curl_setopt($ch, CURLOPT_URL ,"http://data.dianxin.cn/apiCount.php?key=jsdfjsdkue&uid=100018&date=2011-10-09");
        curl_setopt($ch, CURLOPT_HEADER, false);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_jar);
        $orders = curl_exec($ch);
        curl_close($ch);
        preg_match('/\{(\S*)\}/',$orders,$matches);
        if(is_array($matches) && count($matches)>1)
        {
    list($baidusearch,$sougousearch,$adclickcount,$searchcount)=explode(",",$matches[1]);list($name[],$result[])=explode(":",$baidusearch);list($name[],$result[])=explode(":",$sougousearch);list($name[],$result[])=explode(":",$adclickcount);list($name[],$result[])=explode(":",$searchcount);
    print_r($name);
    print_r($result);    }