Posts

Showing posts with the label api

How to add custom design twitter feed in php website?

If you are looking for twitter feed which you can customized your self then Simple copy and paste this code in your page for twitter feed and change the twitter username <?php     $username = "xyz"; // change the username     $limit = 5;     $feed = 'https://api.twitter.com/1/statuses/user_timeline.rss?screen_name='.$username.'&count='.$limit;     $tweets = file_get_contents($feed);   $tweets = str_replace("&", "&", $tweets); $tweets = str_replace("<", "<", $tweets); $tweets = str_replace(">", ">", $tweets); $tweet = explode("<item>", $tweets);     $tcount = count($tweet) - 1; for ($i = 1; $i <= $tcount; $i++) {     $endtweet = explode("</item>", $tweet[$i]);     $title = explode("<title>", $endtweet[0]);     $content = explode("</title>", $title[1]); $content[0] = str_replac

How to get alexa rank using php?

I tried to many script of alexa which return you the rank of website but they all script return 0 always. so i make a new alexa script which return exact rank of website and this works. simple copy and paste alexa script code in your php file, it will also work on localhost <?php     function alexaRank ($domain)     {         $remote_url = 'http://data.alexa.com/data?cli=10&dat=snbamz&url='.trim($domain);         $search_for = '<POPULARITY URL';         $part='';         if ($handle = @fopen($remote_url, "r")) {         while (!feof($handle)) {         $part .= fread($handle, 100);         $pos = strpos($part, $search_for);         if ($pos === false)         continue;         else         break;         }         $part .= fread($handle, 100);         fclose($handle);         }         $str = explode($search_for, $part);         $str = array_shift(explode('"/>', $str[1]));         $str = explo

How to use linkedin login api in my php website?

If you want linkedin login api for your php website and use registration with linkedin then you came on right post. here is some code for your linkedin login follow the instruction as in this post and then You can easily apply this linkedin login in your website add this code in your header Make a linkedin image the name of that image should be linkedin.jpg and place this in your images folder this image will show on linekedin button <script language="javascript" type="text/javascript" src="/js/confirmed_custom.js" ></script> <script type="text/javascript" src="http://platform.linkedin.com/in.js">   api_key: your website likedin api        // HGYbaYgas6Hfa&   onLoad: onLinkedInLoad   authorize: false </script> <script type="text/javascript"> function onLinkedInLoad() { $('a[id*=li_ui_li_gen_]') .css({marginBottom:'20px'}) .html('<img src="images/lin

facebook Send Button pick up default image from site how to change this image according to our us?

Image
when you use Facebook's Send button its shows which images and how to change this image       1st thing you have to do is: follow this link   http://developers.facebook.com/tools/debug enter the url and check the Object Properties and see the title image and description , image of facebook page . now go to header of your website and and set top of the page title , description , keywords , image for image you can paste this code and change the path of website <meta name="image" content="http://www.earlyshares.com/public/images/earlyshares-petition.png" src="http://www.earlyshares.com/public/images/earlyshares-petition.png"/> change the image name according to website which one you want to show in below the facebook send button   please clear the cache and cookie before to test this.   and confirm that meta image code should be top from the send button

How to add twitter share button in our website?

Simple copy and paste this code to add a twitter link in your website  <script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script> <a href="https://twitter.com/share" class="twitter-share-button"           data-url="Your website URL"           data-via="website"           data-text="content you want to share"           data-related="name"           data-count="none">   tweet </a> Now you can share your your content on twitter.

response.session.access_token is not working during the facebook connect?

JavaScript SDK and OAuth 2.0 Roadmap Facebook has updated JavaScript SDK and OAuth 2.0 Roadmap Due to this reason response.session.access_token is not working So You have make some changes in your Facebook login Function   FB.login(function(response) {                 if(response.session) {                     var access_token = response.session.access_token;                     FB.api('/me', function(response) {                     }                 } }   Your code was like this in facebook login function.   So edit some code and make this problem solved    FB.login(function(response) {                     if (response.authResponse) {                     var accessToken = response.authResponse.accessToken;                     alert(accessToken);                     FB.api('/me', function(response) {                     }                 } } So you have to change response.session to response.authResponse and  access_token to accessToken Done

How to print a response object comes by facebook login in javascript or jquery?

Facebook response return an object So for print the response You can use JSON . stringify () function. You can use this function as mention below alert( JSON . stringify (response)); Example : FB.login(function( response ) {                     FB.api('/me', function( response ) {                   var query = FB.Data.query('select src_big from photo where pid in (select cover_pid from album where owner={0} and name="Profile Pictures")', response.id);                  query.wait(function(rows) {                          alert(JSON.stringify(response));                                });                    }); }

How to use facebook api for login Or register on our website?

<!--facebook login--> add latest jquery file on the top of the file <div id="fb-root"></div> <script type="text/javascript">             window.fbAsyncInit = function() {                 FB.init({appId: 'your api id', status: true, cookie: true, xfbml: true});                 /* All the events registered */                 FB.Event.subscribe('auth.login');                 FB.Event.subscribe('auth.logout');                               };                              (function() {                 var e = document.createElement('script');                 e.type = 'text/javascript';                 e.src = document.location.protocol +                     '//connect.facebook.net/en_US/all.js';                 e.async = true;                 document.getElementById('fb-root').appendChild(e);             }());                         function customFbLogin

Uncaught exception in Google authentication in apiOAuth2.php and apiOAuth2->setAccessToken('{? "access_tok...') error

In this google+ api there is main poblem when ever you use api code it shows some uncaught error. like : apiOAuth2->setAccessToken('{? "access_tok...') Or Fatal error : Uncaught exception 'apiAuthException' with message 'Invalid token format' in /home/project/public_html/gplus/src/auth/apiOAuth2.php:109 Stack trace: #0 /home/project/public_html/gplus/src/auth/apiOAuth2.php(74): apiOAuth2->setAccessToken('{? "access_tok...') #1 /home/project/public_html/gplus/src/apiClient.php(130): apiOAuth2->authenticate(Array) #2 /home/project/public_html/gplus/gplus_login.php(15): apiClient->authenticate() #3 /home/project/public_html/gplus/index.php(9): include('/home/project/...') #4 {main} thrown in /home/project/public_html/gplus/src/auth/apiOAuth2.php on line 109 and it will not work on localhost in ..src/auth/apiOAuth2.php file you have the code $accessToken = json_decode($accessToken, true); if (! isset($acces

How to get Longitude and Latitude from an Address using PHP OR get lat long by address using php

How to get Longitude and Latitude from an Address using PHP OR  get lat long by address using php <?php $geocode=file_get_contents('http://maps.google.com/maps/api/geocode/json?address='india'+'noida'+'sector'+'63'+'&sensor=false'); $output= json_decode($geocode); $latitude = $output->results[0]->geometry->location->lat; $longitude = $output->results[0]->geometry->location->lng; ?> Use your lan long where you want...

Google Maps - Simple Multiple Marker API

Google Maps - Simple Multiple Marker API Google map api multiple marker code <!DOCTYPE html> <html>  <head>    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />    <title>Google Maps Multiple Markers</title>    <script src="http://maps.google.com/maps/api/js?sensor=false"            type="text/javascript"></script> </head>  <body>   <div id="map" style="width: 500px; height: 400px;"></div>   <script type="text/javascript">     var locations = [       ['sagar', -33.890542, 151.274856, 4],       ['Coogee Beach', -33.923036, 151.259052, 5],       ['Cronulla Beach', -34.028249, 151.157507, 3],       ['Manly Beach', -33.80010128657071, 151.28747820854187, 2],       ['Maroubra Beach', -33.950198, 151.259302, 1]     ];     var map = new google.maps.Map(document.getElementById('ma