| Server IP : 74.208.250.37 / Your IP : 216.73.216.114 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ubuntu 6.8.0-124-generic #124-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 13:00:45 UTC 2026 x86_64 User : miferval ( 1000) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/aprendizajeodisea/system/back/ |
Upload File : |
<?php
function introText($page){
if(!empty($page['introtext'])){
$html = $page['introtext'];
}
else{
$html = '<div class="white">';
$html .= $page['pagetitle'];
$html .= '</div>';
}
return $html;
}
/*/https://www.facebook.com/feeds/page.php rss feed
*Valid formats json
/*/
function getPageFeed($fbid=0,$format='json'){
//Facebook url for retriving feeds
$url = 'https://www.facebook.com/feeds/page.php?id='.$fbid.'&format='.$format;
//Init curl
$c = curl_init();
//CURL vars
$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: ';
$userAgent = 'Mozilla';
curl_setopt($c, CURLOPT_USERAGENT, $userAgent);
curl_setopt($c, CURLOPT_URL,$url);
curl_setopt($c, CURLOPT_FAILONERROR, true);
curl_setopt($c, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($c, CURLOPT_HTTPHEADER, $header);
curl_setopt($c, CURLOPT_REFERER, '');
curl_setopt($c, CURLOPT_ENCODING, 'gzip,deflate');
curl_setopt($c, CURLOPT_AUTOREFERER, true);
curl_setopt($c, CURLOPT_RETURNTRANSFER,true);
curl_setopt($c, CURLOPT_VERBOSE, false);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($c, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($c, CURLOPT_TIMEOUT, 10);
$feed = curl_exec($c);
switch ($format) {
case 'json':
$feed_decoded=json_decode($feed,true);
$page_feed = $feed_decoded['entries'];
break;
default:
$feed_decoded=json_decode($feed,true);
$page_feed = $feed_decoded['entries'];
break;
}
//close the connection
curl_close($c);
//return the data as an object
return $page_feed;
}
/*/Facebook Graph API
*function to retrieve posts from facebook's server Graph API
*Need to provide TOKEN and page ID in config.php
/*/
function getPagePosts($fbid=0,$fbtoken=0,$limit=20){
// this is the URL that gets the data from facebook
// the ?limit=20 tells facebook how many posts we want
//must be https when using an access token
$url="https://graph.facebook.com/v2.2/".$fbid."?access_token=".$fbtoken."&fields=posts.limit(".$limit."){full_picture,picture,message,link}";
//load and setup CURL
$c = curl_init($url);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($c, CURLOPT_SSL_VERIFYHOST, false);
//get data from facebook and decode JSON
$page = json_decode(curl_exec($c));
$feed = curl_exec($c);
$feed_decoded=json_decode($feed,true);
$page_feed = $feed_decoded['posts']['data'];
//close the connection
curl_close($c);
//return the data as an object
return $page_feed;
}