Php 当页面看起来为空时,如何使用Json或Curl进行检查?

Php 当页面看起来为空时,如何使用Json或Curl进行检查?,php,Php,我有一个使用JSON循环一些数据的函数 问题是weh nmy foreach循环在这里发现了这种情况https://graph.facebook.com/search?q=berlusca&limit=10&type=post&until=1327422514它停止工作 当页面有空数据时,如何检查 这是我的荣幸: function getPostInfo($url, $lang, $stopwords) { $j = json_decode(startCurl($url)); foreach($

我有一个使用JSON循环一些数据的函数

问题是weh nmy foreach循环在这里发现了这种情况
https://graph.facebook.com/search?q=berlusca&limit=10&type=post&until=1327422514
它停止工作

当页面有空数据时,如何检查

这是我的荣幸:

function getPostInfo($url, $lang, $stopwords) {
$j = json_decode(startCurl($url));
foreach($j->data as $v) {
if ($v->type == 'status') {
        $post['author_id'][] = $v->from->id;
        $post['original_id'][] = $v->id;
        $ret['post_url'][] = getPostUrl($original_id, $author_id);
        //$description = stopWords($v->message);
        $post['description'][] = $v->message;
        $post['pub_date'][] = $v->created_time;
    }
}   
 return $post;
}

停止工作是什么意思?而且您没有初始化
$post
if (count($j->data) > 0 ) {
  foreach ...
}