Facebook RSS

30877 vaatamist
  1. Brunn

    2014-02-12 Administrator Estonia

    Autor
    Simplexml versioon:

    <?PHP
    facebooki_lehe_uudised('580301868731057');
    
    function facebooki_lehe_uudised( $page_id, $no = 5 ) {
    	$rss_url = 'http://www.facebook.com/feeds/page.php?id=' . $page_id . '&format=rss20';
    	$curl = curl_init();
            $header[0] = "Accept: text/xml,application/xml,application/xhtml+xml,";
    	$header[0] .= "text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
    	$header[] = "Cache-Control: max-age=0";
    	$header[] = "Connection: keep-alive";
    	$header[] = "Keep-Alive: 300";
    	$header[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7";
    	$header[] = "Accept-Language: en-us,en;q=0.5";
    	$header[] = "Pragma: ";
    	curl_setopt($curl, CURLOPT_URL, $rss_url);
    	curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla');
    	curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
    	curl_setopt($curl, CURLOPT_REFERER, '');
    	curl_setopt($curl, CURLOPT_ENCODING, 'gzip,deflate');
    	curl_setopt($curl, CURLOPT_AUTOREFERER, true);
    	curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    	curl_setopt($curl, CURLOPT_TIMEOUT, 10);
     	$raw_xml = curl_exec($curl);
    	curl_close($curl);
    	print  $raw_xml;
    	$xml = simplexml_load_string( $raw_xml );
      	$out = ''; 
    	$i = 1;
    	foreach( $xml->channel->item as $item ){
     
    		$out .= '<div class="entry">';
    		$out .= '<h3 class="title"><a href="' . $item->link . '">' . $item->title . '</a></h3>';
    		$out .= '<div class="meta">' . $item->pubDate . ' by '. $item->author .'</div>';
    		$out .= '<div class="content">' . $item->description . '</div></div>';
    		if( $i == $no ) break;
    		$i++;
    	}
    	echo $out;
    }
    ?>
  2. Brunn

    2014-02-22 Administrator Estonia

    Facebooki lehe id pärimine:
    http://findmyfacebookid.com
    Pikem artikkel:
    http://rieglerova.net/how-to-get-a-facebook-fan-page-id/

  3. Brunn

    2014-02-22 Administrator Estonia

    Avalikest gruppidest uudiste tirimine siit http://www.wallflux.com/#rss , sisestades grupi id. Kui seda ei tea, saab grupi,lehe id'd pärida siit: http://www.wallflux.com/#find-id .
    Samuti on võimalik teatud summa eest 5€ ,ühekordne tasu, kui ma ei eksi, pärida suletud gruppide uudiseid, loomulikult, kui kuulud administraatorite hulka.
    Domdocument versioon:

    $rss = new DOMDocument();
    $rss->load('http://www.wallflux.com/feed/1428654234016531');
    
    $feed = array();
    
    foreach ($rss->getElementsByTagName('item') as $node) {
    	$item = array ( 
    		'title' => $node->getElementsByTagName('title')->item(0)->nodeValue,
    		'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue,
    		'link' => $node->getElementsByTagName('link')->item(0)->nodeValue,
    		'date' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue,
    		);
    	array_push($feed, $item);
    }
    $limit = 50;
    for($x=0;$x<$limit;$x++) {
    	$title = str_replace(' & ', ' & ', $feed[$x]['title']);
    	$link = $feed[$x]['link'];
    	$description = $feed[$x]['desc'];
    	$date = date('l F d, Y', strtotime($feed[$x]['date']));
    	echo '<p><strong><a href="'.$link.'">'.$title.'</a></strong><br />';
    	#echo '<small><em>Posted on '.$date.'</em></small></p>';
    	echo '<p>'.$description.'</p>';
    }
  4. Brunn

    2014-02-22 Administrator Estonia

    Facebooki rss voog, teades lehe ID'd https://www.facebook.com/feeds/page.php?id=1444363999129323&format=rss20

  5. Brunn

    2014-02-22 Administrator Estonia

    Facebooki ühendamine Twitteriga:
    https://www.facebook.com/twitter

    Twitteri ühendamine Facebookiga:
    https://support.twitter.com/articles/31113