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 “PHP simple captcha script”

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 “Extract website data using php”

Get user geolocation using javascript

W3C has introduced geolocation API in html5. We can use this API to get geographic location of client side device using javascript. Location of device determined by various sources like GPS, wifi network, Bluetooth mac address, GSM/CDMA cell IDs etc. In this article i will explain how to use this API.

List of Geolocation API capable browsers

  • Internet Explorer 9+
  • Firefox 3.5+
  • Chrome
  • Safari 5+
  • Opera 10.6+

Continue reading “Get user geolocation using javascript”

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 Alexa Rank”

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 “PHP script to get pagerank”