Friday, 31 January 2014

What is memcache and why you use memcache for your website


Memcache with PHP Memcache is Free & open source, high-performance, distributed memory object caching system which improves the website performance In simple words every time your website opens it fetches data from database. Memcache cache this data locally on temporary cache so that every time your website page open it won’t run sql queries to fetch data from DB.

How to Install Memcache in Ubuntu

Thursday, 23 January 2014

Difference Between Single And Double Quotes in PHP


Difference Between Single And Double Quotes in PHP In PHP you can specify the strings by using single and double quotes. There are other methods (heredoc and nowdoc (since PHP 5.3.0)) are also used but first two are used mostly.
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:
When string is specified in single quotes PHP will not evaluate it or interpret escape characters except single quote with backslash (‘) and backslash(\) which has to be escaped.
  <?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:
In double quoted strings other escape sequences are interpreted as well any variable will be replaced by their value.
  <?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 ?

What is Filezilla and how to use it?

FileZilla is a free,open source and cross-platform FTP/SFTP client used to upload files to web server from local machine.
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.
i will explain in this article how to upload files to server using FileZilla?

First download the FileZilla from its official website.Download the FileZilla here. Download the FileZilla according to your OS. Once the application has been downloaded install FileZilla and run the application.

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


How to Attacch File/Image From External URL to e-mail Iam Previously explain about sending e-mails using PHPmailer and Gmail server in this added a code for attachment File/Image from Folder But
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');
In case file_get_cotents field to load file use cURL,
Read More info about file_get_contents and cURL Click Here

Saturday, 21 December 2013

How To Validate Email, URL And IP in PHP


How To Validate Email, URL And IP in PHP I know to most PHP programmers, this isn’t a big deal. I am going to show us, how to validate Email, URL and IP address using their respective PHP validation function.
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

Sending e-mail using SMTP server of Gmail with PHP.


Sending e-mail using SMTP server of Gmail with PHP. This article is about send emails in SMTP(Simple Mail Transfer Protocol) using phpmailer by gmail server,
Here we are using PHPMailer for send emails using SMTP in php
It is very easy process.....


Tuesday, 17 December 2013

Get longitude & latitude values with Google Maps API using PHP


Get longitude & latitude with Google Maps API get the latitude and longitude values from Google Maps API, based on the town, city or country location.
<?php
  $url = "http://maps.google.com/maps/api/geocode/json?address=hyderabad&sensor=false&region=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 http://maps.google.com/maps/api/geocode/json URL takes in 3 parameters: address (your main location), region (optional but can help with ambiguity) and sensor (indicates whether or not the request will come from a device with a locational sensor).
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.

More Info vist: developers.google.com