Category Archives: PHP

Read Rss/Atom feed using php

Web feed is a data format used to provide updates for blog or website. Most common types of feed are Rss and Atom. In this article you will learn how to read these feeds using php.

As we know that feeds are generated by using XML, so generic way to parse it by using php5 simplexml_load_file function. But we have to write different functions to parse different types of feed and versions.

To do this in simple way there is a php class named SimplePie

Continue reading

PHP simple captcha script

A CAPTCHA is a type of challenge-response test used in website as an attempt to ensure that the response is generated by a human being. There are basically 3 types of captcha first one and widely used is image captcha , second is mathematical captcha and last one is vice captcha.

In this tutorial you will learn how to generate and use image captcha using php. Continue reading

Extract website data using php

Many time web programmer needs to get some data from other website. Extraction of particular data from other website is also known as web scraping or Web Harvesting. In this tutorial i will explain how to extract data from website using php.

First extract complete html source of webpage

php has inbuilt function file_get_contents to do this

$html=file_get_contents("http://www.somewebsite.com")

Continue reading

PHP Script to get Alexa Rank

Alexa traffic rank is a value given to any website by alexa based on it’s traffic. A lower traffic rank means higher traffic volume to a website. Alexa is providing an paid API to access it database. But there is a way to do this for free. To get this data in XML format use following URL

http://data.alexa.com/data?cli=10&dat=snbamz&url=<yourwebsite.com>

Continue reading

PHP script to get pagerank

Update: No more Pagerank. On April 15, 2016 Google has officially shut down their Google Toolbar PageRank Data to public

Pagerank is a ranking given to any page (between 0 to 10) by google. It is based upon total numbers of backlinks to page. The higher pagerank will get higher position in search result.

As we can view pagerank of any page in google toolbar. But google doesn’t provide any API to access it’s Pagerank database. So in this article i will explain you how to get this pagerank value using php code.
Continue reading