Php – How to get Whois Information of IP address with Sockets
This is a small script written in php that can fetch the whois information of an ip address from regional internet registries (RIR). Useful in finding information about ip address.
This is a small script written in php that can fetch the whois information of an ip address from regional internet registries (RIR). Useful in finding information about ip address.
The simplexml extension of php is quite simple and easy to use when it comes to parsing “well-formatted” xml files. Well formatted means , xml that is not broken or does not have too many errors. One of the most handy functions of this extension is simplexml_load_string. Here is an example : <?php $xml =… Read More »
MPDF Many php applications need to create pdf of documents like invoice , receipt and even id card etc. In this article we shall create a pdf invoice using the mpdf pdf creation library. Mpdf is made in php without any other external library. Mpdf parses css much better than any other free pdf libraries… Read More »
Packet Sniffer Example of a packet sniffer is Wireshark. Packet sniffers pick up the packets going in and out of a system and analyse them and present them to user for further analysis. In this post we are going to code a simple packet sniffer in php. The basic theory this packet sniffer is that… Read More »
Php functions like zip_open return an error number if they fail. To get the corresponding error message from the error number , use the following function. function zip_error_message($errno) { // using constant name as a string to make this function PHP4 compatible $zipFileFunctionsErrors = array( 'ZIPARCHIVE::ER_MULTIDISK' => 'Multi-disk zip archives not supported.', 'ZIPARCHIVE::ER_RENAME' => 'Renaming… Read More »
When a browser makes a request to a php script, the browser sends some http headers which can look like this : Host: localhost Connection: keep-alive User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 Accept-Charset: UTF-8,*;q=0.5 Cookie: username=admin; password=21232ffc3; PHPSESSID=o5m4e2td1m66c4pkjdag9vs0u2 The php script under request ,… Read More »
In this article we are going to login into Google Adsense and retrieve earnings. Google Adsense now has a new interface and so needs a different kind of coding. In this example we shall fetch “yesterday’s” earnings sitewise. Create a Report to be fetched : First open the sitewise report in the Performance Tab in… Read More »
PHP has a useful function called dns_get_record that can be used to get different types of records for a give domain , very easily. These include the nameserver records, A records, CNAME records, MX records, SOA records etc. The following examples are using the interactive shell, but you would use the function the same way… Read More »
If you have used codeigniter or some mvc php framework then you might be aware of urls like www.yoursite.com/index.php/class/method/param1/param2?a=b&c=d or www.yoursite.com/class/method/param1/param2?a=b&c=d if you use mod rewrite to add the index.php The htaccess code could be like this : <IfModule mod_rewrite.c> #Start the rewrite engine RewriteEngine on #If requested thing is not a file or directory… Read More »
PHP Handlers PHP handlers are a link between a webserver(say Apache) and the PHP libraries. PHP handlers enable a webserver to load the PHP library in a certain manner and execute the PHP code and return the output to the webserver. There are many different kind of PHP handler setups available. Each has its own… Read More »