This PHP class is a growing collection (from 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.
<br /> include("minibots.class.php");<br /> $mb=new Minibots();<br /> $gps = $mb->getLatLong("Piazza Duomo, Milan, Italy");<br /> print_r($gps);<br />
And this will be the output, which you can include and use in a Google Map:
<br /> Array (<br /> [lat] => 45.465454000000001<br /> [long] => 9.1865159999999992<br /> )<br />
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
<br /> include("minibots.class.php");<br /> $mb=new Minibots();<br /> $obj = $mb->ipToGeo();<br /> print_r($obj);<br />
And you’ve got this:
<br /> stdClass Object<br /> (<br /> [ip] => 184.108.40.206<br /> [country_code] => IT<br /> [country_name] => Italy<br /> [region_code] => 25<br /> [region_name] => Lombardy<br /> [city] => Milan<br /> [zip_code] => 20121<br /> [time_zone] => Europe/Rome<br /> [latitude] => 45.4667<br /> [longitude] => 9.2<br /> [metro_code] => 0<br /> )<br />
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:
<br /> include("minibots.class.php");<br /> $mb=new Minibots();<br /> $obj = $mb->wikiDefinition("favignana");<br /> print_r($obj);<br />
And this will be the output object, available in your code:
<br /> stdClass Object (<br /> [title] => Favignana<br /> [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.<br /> [thumbnail] => stdClass Object (<br /> => https://upload.wikimedia.org/wikipedia/commons/thumb/c/c8/Favignana.jpg/320px-Favignana.jpg<br /> [width] => 320<br /> [height] => 240<br /> [original] => http://upload.wikimedia.org/wikipedia/commons/c/c8/Favignana.jpg<br /> )<br /> [originalimage] => stdClass Object (<br /> => https://upload.wikimedia.org/wikipedia/commons/c/c8/Favignana.jpg<br /> [width] => 800<br /> [height] => 600<br /> )<br /> [lang] => en<br /> [dir] => ltr<br /> [timestamp] => 2017-01-22T21:52:40Z<br /> [description] => Italian comune<br /> [coordinates] => stdClass Object (<br /> [lat] => 37.93505556<br /> [lon] => 12.27233333<br /> )<br /> [url] => https://en.wikipedia.org/wiki/Favignana<br /> )<br />
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
- 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 NotifyMyAndroid service
This is a growing and changing list.
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.