This PHP class is a growing collection (since 2010!!) of small spiders and web bots that go out on the web and make some small useful jobs. This software can help to build your spider PHP scripts and easily brings new functionalities to your works.
You can do very nice works with CURL using php and this class, this small web bots can be included in your own works with a few line of code:
Get GPS coordinates from an address (geocode an address)
If you need to show a place on a map you need to convert the address from street, number and country, to a couple of GPS coordinates. You can use this getLatLong method of MiniBots class.
include("minibots.class.php"); $mb=new Minibots(); $gps = $mb-getLatLong("Piazza Duomo, Milan, Italy","APIKEYHERE"); print_r($gps);
And this will be the output, which you can include and use in a Google Maps:
Array ( [lat] = 45.465454000000001 [long] = 9.1865159999999992 )
Convert an IP address to a GPS location (Georeferencing IPs)
If you need to perform some action on users coming from a specific geographical location, you can use the MiniBots Class to convert an IP address to a geographical location, so you can for example choose what to show based on the country of the user. There are two methods that performs the same job but using different free services, here is the
include("minibots.class.php"); $mb=new Minibots(); $obj = $mb-ipToGeo(); print_r($obj);
And you’ve got this:
stdClass Object ( [ip] = 188.8.131.52 [country_code] = IT [country_name] = Italy [region_code] = 25 [region_name] = Lombardy [city] = Milan [zip_code] = 20121 [time_zone] = Europe/Rome [latitude] = 45.4667 [longitude] = 9.2 [metro_code] = 0 )
Get informations from WikiPedia with PHP
In this class there is this method called
wikiDefinition which allows you to retrieve basic informations from WikiPedia, for example you can search a famous people name and find the picture to show its face. Or you can search for a monument and get its GPS latitude and longitude coordinates.
The call is very simple and the results are packed into an object that you can easily parse to get everything you need, for example here is a call to retrieve informations about the small island of Favignana in Mediterranean sea:
include("minibots.class.php"); $mb=new Minibots(); $obj = $mb-wikiDefinition("favignana"); print_r($obj);
And this will be the output object, available in your code:
stdClass Object ( [title] = Favignana [extract] = Favignana is a comune including three islands (Favignana, Marettimo and Levanzo) of the Aegadian Islands, southern Italy. It is situated approximately 7 kilometres (4 miles) west of the coast of Sicily, between Trapani and Marsala, the coastal area where the Stagnone Lagoon and the international airport of Trapani, are sited. [thumbnail] = stdClass Object ( = https://upload.wikimedia.org/wikipedia/commons/thumb/c/c8/Favignana.jpg/320px-Favignana.jpg [width] = 320 [height] = 240 [original] = http://upload.wikimedia.org/wikipedia/commons/c/c8/Favignana.jpg ) [...cutted...] )
In the following list there are all the methods included in this class.
List of all features included:
- get ip address of the user
- add days to a date
- functions to easily parse attributes and tags from html
- get remote pages also with POST data
- get all links and all emails from a page
- extract text from a page
- function to make urls from local to absolute (useful during spidering)
- get the size of a remote file and check if a remote url exists
- copy a remote file to your server
- make SMTP validation for an address
- get informations on any URL (extract meta data, works also with Amazon products)
- get informations on YouTube and Vimeo URLs (also Youtube views count)
- read Facebook sharing counters for any URLs with Facebook App
- read Facebook fan counters for Facebook pages, without any facebook integration
- get tweet counters for shared counters
get Google Plus counters
- get Twitter user informations (with number of followers)
- get images from Instagram both with username and with hashtags
- get user counters for an Instagram user
- get sharing counters for Pinterest
get sharing counters for Linkedin
- get Google suggest for a bad spelled keyword
- convert an address to GPS coordinates
- get informations from Wikipedia
- geocode an ip address to a GPS coordinates and textual informations (region, country…)
- get money exchange rates
- get images for search engine (Picsearch) with any words
- get Gravatar pic for an email
- interact with Pingomatic service
- interact with NotifyMyDevice service
This is a growing and changing list.
Some methods could stop working, so please check if the method you need is working with the interactive demos of MiniBots Class. If the method you’re searching isn’t available in the interactive page you can try the complete demo test page.
Documentation, support and limitations
Every method is easy to call and documented. The documentation of the class explicitly tells to pay attention to use this class especially for production systems. It comes as it is and even if I give you support through CodeCanyon, sometimes free services are closed and can’t be scraped anymore.
Moreover, sometimes services automatically blocks spiders that makes many requests and couse heavy traffic. Remember alsways that heavy traffic means heavy costs for servers, so don’t make too many requests and store data locally when possible. Check the services you’re using (in documentations you will find the name of them) and if you have to make heavy usage contact them and buy their services.
If you’re interested on making spiders, here is a tutorial on how to build a spider.
Download MiniBots Class / Price and buy
This class is available for download for just
16$ on CodeCanyon.