<?php /* Online PHP Examples with Source Code website: http://4evertutorials.blogspot.in/ */ $url = "http://4evertutorials.blogspot.com/"; $var = fread_url($url); preg_match_all ("/a[\s]+[^>]*?href[\s]?=[\s\"\']+". "(.*?)[\"\']+.*?>"."([^<]+|.*?)?<\/a>/", $var, &$matches); $matches = $matches[1]; $list = array(); foreach($matches as $var) { print($var."
"); } // The fread_url function allows you to get a complete // page. If CURL is not installed replace the contents with // a fopen / fget loop function fread_url($url,$ref="") { if(function_exists("curl_init")){ $ch = curl_init(); $user_agent = "Mozilla/4.0 (compatible; MSIE 5.01; ". "Windows NT 5.0)"; $ch = curl_init(); curl_setopt($ch, CURLOPT_USERAGENT, $user_agent); curl_setopt( $ch, CURLOPT_HTTPGET, 1 ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt( $ch, CURLOPT_FOLLOWLOCATION , 1 ); curl_setopt( $ch, CURLOPT_FOLLOWLOCATION , 1 ); curl_setopt( $ch, CURLOPT_URL, $url ); curl_setopt( $ch, CURLOPT_REFERER, $ref ); curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt'); $html = curl_exec($ch); curl_close($ch); } else{ $hfile = fopen($url,"r"); if($hfile){ while(!feof($hfile)){ $html.=fgets($hfile,1024); } } } return $html; } ?>
Saturday, March 2, 2013
Get all links from url php
Get all links from url php
Get facebook page likes php
It is simple php code that get the number of users who like a particular Facebook page
<?php /* Online PHP Examples with Source Code website: http://4evertutorials.blogspot.in/ */ $fb_URL = "http://www.facebook.com/forevertutorials"; # FB Page url $myurl = "https://graph.facebook.com/".$fb_URL."?fields=likes"; $result = file_get_contents($myurl); $response = json_decode($result, true); if(count($response)) { echo "FB Page URL: ". $fb_URL; echo " "; echo "FB Page ID: ". $response['id']; echo " "; echo "FB Page TOTAL LIKES: " .$response['likes']; echo " "; } ?>
By: 4evertutorials
On 3/02/2013
Get all followers of specify user from Twitter by PHP
There are many ways for getting Twitter follower count but the simplest of them is by using a simple PHP method explained on this article.
<?php /* Online PHP Examples with Source Code website: http://4evertutorials.blogspot.in/ */ $screenName = "4evertutorial"; #user name on twitter $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://api.twitter.com/1/statuses/user_timeline.json?include_entities=false&include_rts=false&screen_name=$screenName&count=1"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $curlout = curl_exec($ch); curl_close($ch); $response = json_decode($curlout, true); if(count($response)) { echo $response[0]['user']['id']; echo "
"; echo $response[0]['user']['name']; echo "
"; echo $response[0]['user']['screen_name']; echo "
"; echo $response[0]['user']['location']; echo "
"; echo $response[0]['user']['description']; echo "
"; echo $response[0]['user']['followers_count']; echo "
"; echo $response[0]['user']['friends_count']; echo "
"; echo $response[0]['user']['profile_background_image_url']; echo "
"; echo $response[0]['user']['profile_image_url']; } ?>
By: 4evertutorials
On 3/02/2013
Subscribe to:
Posts (Atom)