Creating thumbnails of the images is required many a times, this code will be useful to know about the logic of thumbnail generation.
Read More »Parse XML Data
Parsing XML essentially means navigating through an XML document and returning the relevant data. An increasing number of web services return data in JSON format, but a large number still return XML, so you need to master parsing XML if you really want to consume the full breadth of APIs …
Read More »Retrieve Google Analytics Visits and PageViews with PHP
Google Analytics is an outstanding website analytics tool that gives you way more information about your website than you probably need. Better to get more than you want than not enough, right? Anyways I check my website statistics more often than I should and it ends up taking a few …
Read More »Convert Text To Image
You can convert text to image by using this php code. You then download the image file.
Read More »Whois Query In PHP
Using the below function you would be able to get complete whois details regarding the owner of any domain. This is the easiest way to find details of any domain.
Read More »Parse JSON Data Using PHP
With most of the popular web services like Twitter providing their data through APIs, it is always helpful to know how to parse API data which is sent in various formats including JSON, XML etc.
Read More »Generate An Authentication Code in PHP
This basic snippet will create a random authentication code, or just a random string. <?php # This particular code will generate a random string # that is 25 charicters long 25 comes from the number # that is in the for loop $string = “abcdefghijklmnopqrstuvwxyz0123456789”; for($i=0;$i<25;$i++){ $pos = rand(0,36); $str …
Read More »Encode Email Address using php
With this snippet, you can encode any email address into HTML entities so that spam bots do not find it. function encode_email($email=’info@domain.com’, $linkText=’Contact Us’, $attrs =’class=”emailencoder”‘ ) { // remplazar aroba y puntos $email = str_replace(‘@’, ‘@’, $email); $email = str_replace(‘.’, ‘.’, $email); $email = str_split($email, 5); $linkText = str_replace(‘@’, …
Read More »Validate Email Address
Sometimes, while filling forms on your website, a user can mistype his email address. Using the below function you can check if the email provided by user is in correct format.
Read More »SHOW NUMBER OF PEOPLE WHO HAVE LIKED YOUR FACEBOOK PAGE
function fb_fan_count($facebook_name) { $data = json_decode(file_get_contents(“https://graph.facebook.com/”.$facebook_name)); $likes = $data->likes; return $likes; } Syntex: <?php $page = “w2class.com”; $count = fb_fan_count($page); echo $count; ?>
Read More »