How to Install Memcache in Ubuntu
Friday, 31 January 2014
What is memcache and why you use memcache for your website
How to Install Memcache in Ubuntu
Thursday, 23 January 2014
Difference Between Single And Double Quotes in PHP
It is important to know the difference between using single quotes and double quotes. In this post we will see the difference between them and which should be used when
Single Quotes:
<?php $name = 'srinu chilukuri'; $member = 'This is $name'; echo $member; ?>If echo $member variable it will print the result as it is without interpreted.
output: This is $name
Double Quotes:
<?php $name = 'srinu chilukuri'; $member = "This is $name"; echo $member; ?>output: This is srinu chilukuri
Sunday, 5 January 2014
What is Filezilla and how to use it ?
FileZilla is a popular FTP/SFTP used by most of people. Its interface and functionality is more user friendly. And main thing is its secure.
Now we have to do some setting to connect to web server.
Launch the FTP client software on your local computer.
Monday, 23 December 2013
How to Attacch File/Image From External URL(remote file/image) to e-mail
Now i'am Explain about how to attach a File/Image from External URl.
General File/Image attachemnet:
$mail->AddAttachment("images/kc_logo.jpg");File/Image attachment from Remote:
$string = file_get_contents("http://sri-knowledgecorner.rhcloud.com/images/blogicon.jpeg"); $mail->AddStringAttachment($string, "01182013_220715.jpg", $encoding = 'base64', $type = 'application/octet-stream');
Read More info about file_get_contents and cURL Click Here
Saturday, 21 December 2013
How To Validate Email, URL And IP in PHP
It is very important input by users are validated before they are sent for processing. Not validating what users enter can lead to a very big security breach and could make your website susceptible to hackers. PHP has a large number of filters for validation and sanitization, but we’re only going to see that of the Email, URL and IP address.
Let’s take a look at these validation filters and how they work.
Validating Email:
Function :– filter_var($value, FILTER_VALIDATE_EMAIL)
<?php $email = "knowledgecorner@gmail.com"; if (filter_var($email, FILTER_VALIDATE_EMAIL)) { echo "This ($email) email is valid."; } else { echo "This ($email) is not valid."; } ?>Validating URL:
Function – filter_var($value, FILTER_VALIDATE_URL)
<?php $url = 'knowledgecorner.com'; if (filter_var($url, FILTER_VALIDATE_URL)) { echo "This ($url) URL is valid."; } else { echo "This ($url) URL is not valid."; } ?>Validating IP address:
Function – filter_var($value, FILTER_VALIDATE_IP)
<?php $ip = '10.199.212.2'; if (filter_var($ip, FILTER_VALIDATE_IP)) { echo "This ($ip) IP address is valid."; } else { echo "This ($ip) IP address is not valid."; } ?>
Thursday, 19 December 2013
Tuesday, 17 December 2013
Get longitude & latitude values with Google Maps API using PHP
<?php $url = "http://maps.google.com/maps/api/geocode/json?address=hyderabad&sensor=false®ion=IN"; $response = file_get_contents($url); $response = json_decode($response, true); //print_r($response); $lat = $response['results'][0]['geometry']['location']['lat']; $long = $response['results'][0]['geometry']['location']['lng']; echo "latitude: " . $lat . " longitude: " . $long; ?>
The print_r command commented out above is a useful way to work out the array structure that you need to drill down to. To get the longitude and latitude values, we need to drill down through 5 levels.
Subscribe to:
Posts (Atom)