我有很大的困难。我需要从这个多维数组中检索[title]、[url]和[abstract]值。
另外,我必须将这些值存储在 mysql 数据库中。
提前致谢!!!
大批 ( [bossresponse] => 数组 ( [响应码] => 200 [limitedweb] => 数组 ( [开始] => 0 [计数] => 20 [总结果] => 972000 [结果] => 数组 ( [0] => 数组 ( [日期] => [点击网址] => http://www.torchlake.com/ [网址] => http://www.torchlake.com/ [dispurl] => www. 火炬湖.com [title] => Torch Lake , COLI Inc, Highspeed, Dial-up, Wireless ... [摘要] => 欢迎来到 COLI Inc. Chain O' Lake Internet。密歇根州北部本地 ISP,在北部提供拨号互联网接入、无线接入、网页设计和 T1 服务... ) [1] => 数组 ( [日期] => [clickurl] => http://en.wikipedia.org/wiki/Torch_Lake_(Antrim_County,_Michigan) [url] => http://en.wikipedia.org/wiki/Torch_Lake_(Antrim_County,_Michigan) [dispurl] => en.wikipedia.org/wiki/ Torch_Lake _(Antrim_County,_Michigan) [title] =>火炬湖(密歇根州安特里姆县)- 维基百科,免费 ... [摘要] =>长 19 英里(31 公里)的火炬湖是密歇根州最长的湖泊,面积约为 18,770 英亩(76 平方公里),是密歇根州的第二大湖。里面有几... )
这是生成此数组的完整代码:
要求(“OAuth.php”); $cc_key = ""; $cc_secret = ""; $url = ""; $args = 数组(); $args["q"] = "汽车"; $args["格式"] = "json"; $args["计数"] = 20; $consumer = new OAuthConsumer($cc_key, $cc_secret); $request = OAuthRequest::from_consumer_and_token($consumer, NULL,"GET", $url, $args); $request->sign_request(new OAuthSignatureMethod_HMAC_SHA1(), $consumer, NULL); $url = sprintf("%s?%s", $url, OAuthUtil::build_http_query($args)); $ch = curl_init(); $headers = array($request->to_header()); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); $rsp = curl_exec($ch); $results = json_decode($rsp, true);