我使用的脚本可以获取某个页面的社交网络供稿,但是在Facebook页面中我会看到损坏的图像,它会显示信息,但不显示照片。
生成Feed数据的Facebook功能(class:socialparser):
/** FACEBOOK PARSE **/
public function facebook($id,$num){
$loader = 'https://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num='.$num.'&q=';
$UriEncoded = $this->encodeURIComponent('https://www.facebook.com/feeds/page.php?id='.$id.'&format=rss20');
$url = $loader.$UriEncoded;
$response = $this->curl_call($url);
$entries = $response['responseData']['feed']['entries'];
$posts = array();
foreach($entries as $post){
array_push($posts,$post);
}
return $posts;
}
调用Feed:
$socialparser = new Socialparser();
$facebook_posts = $socialparser->facebook('81221197163',5);
<h2>Facebook</h2>
<ul>
<? foreach($facebook_posts as $fb){ ?>
<li>
<p><? echo $fb['title'] ?></p>
<p><? echo $fb['content'] ?></p>
</li>
<hr>
<? } ?>
</ul>