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 *

Most Popular Posts

Inheritance in object-oriented PHP

Posted on 1 year ago

Bhumi

How to check user is logged in Modx

Posted on 5 years ago

Bhumi

How to Use HTML5 Data Attributes

Posted on 2 years ago

Bhumi

How to Use PHP CodeSniffer?

Posted on 1 year ago

Bhumi

Overview of ECMAScript 6 new Features

Updated 18 years ago

Bhumi

Getting started with Amazon Web Services

Updated 18 years ago

Bhumi

Facade implementation in Laravel

Updated 18 years ago

Bhumi

The Reader’s Poll – June 2015

Posted on 2 years ago

Bhumi

The Reader’s Poll – August 2014

Posted on 3 years ago

Bhumi

The Reader’s Poll – June 2014

Posted on 3 years ago

Bhumi

The Readers’ Poll – May 2014

Posted on 3 years ago

Bhumi

The Readers’ Poll – August 2013

Posted on 4 years ago

Bhumi