Back to Top

How to Fetch Twitter data using cURL

PHP is such a straightforward language and with cURL we can fetch any data from certain URL by passing information.

In this article, I am going to explain how to fetch twitter data with the use of cURL and to get a stream of JSON from Twitter

Twitter very helpfully allows you to fetch information.you just have to send a JSON string to the JSON URL and you will get a JSON string back then you can use json_decode to transform the JSON string to PHP array.

Let’s see the following code:

Above example, fetch all data from the twitter. but you can use data you want to.This function is a very basic example of CURL request.

NOTE: you can also fetch data in XML format by using the URL http://twitter.com/users/show.xml?screen_name=username

By the end, I suggest you to try:

To create zoho leads using PHP
To read JSON data with jQuery
To get Latitude and longitude using address

Thanks for reading and feel free to share your thoughts! Don’t Forget to Follow us on Twitter or Subscribe us to Get the Latest Updates.

Comments (2)

  1. a script to read that ‘anti-spam’ captcha can be written in less lines than ur script.

    2 colors, no distortion. cant make it easier.

    1. Yes, you can reduce script by removing those lines also. 😉

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Most Popular Posts

How To hide WordPress Toolbar

Posted on 8 years ago

Bhumi

The Readers’ Poll – August 2012

Posted on 12 years ago

Bhumi

Constructor and Destructor in PHP

Posted on 12 years ago

Bhumi