Click here to join 1000 satisfied readers Get in touch Click here to join 1000 satisfied readers Portfolio Read my blog Home

Here you can find my latest tutorials, blog posts or you can hire me to help your business grow.

Enjoy your visit.

Delicous saves: 0

 

Like me, if you’ve ever wanted to use a Web Service from a site that doesn’t have that many code examples or a solid API, chances are you may have considered using cURL – a great extension to PHP that allows you to authenticate with websites just like a normal user would. The benefits of doing this are that you’re able to gain access to rich data sources like contact lists, email, statuses and a whole lot more. In this post I’m going to provide you with 20 code examples that’ll help you do some pretty cool things using everything from Bit.ly to Las.fm. Sites covered are Yahoo.com, Last.fm, Amazon, Wordpress, Facebook, TwitPic, PayPal, Bit.ly, Twitter, GMail, MySpace, is.gd and IMDB.

 

  1. How to shorten a URL through bit.ly
  2. Get the trending topics on Twitter
  3. How to get the album covers of your most recent tracks on Last.fm
  4. Get the list of your Yahoo Contacts via cURL
  5. How to get your very latest tweets
  6. How to update your Twitter Status
  7. How to upload files to Facebook
  8. How to import your GMail Contacts
  9. Upload files using Amazon S3 and PHP
  10. How to login to mySpace through cURL
  11. How to upload videos to YouTube (API reference)
  12. How to make a post to Wordpress
  13. How to parse out a movie’s details using IMDB
  14. How to Scape Bing.com for Search Results
  15. How to update your Facebook status
  16. How to upload a picture to TwitPic through cURL
  17. How to process Payments using PayPal, cURL and CakePHP
  18. Scrobble tracks to your Last.fm account using cURL
  19. How to download videos in any format from YouTube
  20. How to shorten a URL using the is.gd Shortening service
  21. How to grab the number of subscribers from your Google Reader Account

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

11 Responses »

  1. Really nice!

  2. Really nice!

  3. I believe the facebook update one is the really old version which doesn't work anymore

  4. How to fetch friend image after logging in facebook or myspace or orkut using curl?

  5. I've been personally using the Official API for all Facebook related things for a while now, but if you're interested in some alternative code for achieving this via CURL, here's a nice little snippet from Snipplr http://snipplr.com/view/29070/how-to-change-faceb...

  6. I've been personally using the Official API for all Facebook related things for a while now, but if you're interested in some alternative code for achieving this via CURL, here's a nice little snippet from Snipplr http://snipplr.com/view/29070/how-to-change-faceb...

  7. I've been personally using the Official API for all Facebook related things for a while now, but if you're interested in some alternative code for achieving this via CURL, here's a nice little snippet from Snipplr http://snipplr.com/view/29070/how-to-change-faceb...

  8. It depends on what you're trying to do. If you're only interested in the thumbnail (and not a higher res version) you should just be able to load in the URL to their friend profile directly and use regular expressions to extract the URL to their friend image. That said, it might just be easier for you to try doing this via the Facebook API as they have methods for grabbing friend images fairly painlessly.

  9. Thank you!

  10. I have done this:
    $login_email = XXXXXXXXX;
    $login_pass = 'XXXXXXXXXXX';

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, 'https://login.facebook.com/login.php?m&next=http%3A%2F%2Fm.facebook.com%2Fhome.php');
    curl_setopt($ch, CURLOPT_POSTFIELDS,'email='.urlencode($login_email).'&pass='.urlencode($login_pass).'&login=Login');
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_COOKIEJAR, "my_cookies.txt");
    curl_setopt($ch, CURLOPT_COOKIEFILE, "my_cookies.txt");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3");

  11. curl_exec($ch);
    curl_setopt($ch, CURLOPT_POST, 0);
    curl_setopt($ch, CURLOPT_URL, 'http://m.facebook.com/profile.php?id='.$id);
    $page = curl_exec($ch);
    $profile_pic=substr($page,strpos($page,'http://profile.'),(strpos($page,'class="p"')-strpos($page,'http://profile.'))-2);
    echo '<img src="'.$profile_pic.'" width="50">';
    Thanx for your code. Please let me know if there is a better solution

Leave a Reply