Sunday, October 24, 2010

php source code

you can download it from php.net/downloads.php

increase execution time in php

We can increase it in different ways based on server

Method 1: It will work in most servers. Add this function in top of page.
ini_set('max_execution_time', 600); //600 seconds

Method 2: We can set it by using .htaccess. Adding the below line in .htaccess file. It will work almost all servers.
max_execution_time 600

Method 3: If it is localhost. Open php.ini file and this word ('max_execution_time') where you can see like this by default max_execution_time = 30. You can change that 30 to your required based on your execution time for example (600) after that you have to restart the apache server.

freelance job sites

www.odesk.com
www.guru.com
www.freelancer.com
www.ifreelance.com
www.getfreelancer.com
www.freelancers.net

many more are there.......

Create csv file in php

$data = "Id, FirstName, LastName, Email, Phone, ZipCode"."\n";
$data .= "1,'Test1','Test2','Test@gmail.com','546435','10001'"."\n";

$myFile = "userinfo.csv";
$fh = fopen($myFile, 'a') or die("can't open file");
fwrite($fh, $data);
fclose($fh);

Saturday, October 9, 2010

difference between curl and file_get_contents

file_get_contents - It is a function to get the contents of a file(simply view source items i.e out put html file contents).

curl - It is a library to do more operations, for example get the contents like file_get_contents, sending and receiving data from one site to another site and it also supports different types of protocols like http, https, ftp, gopher, telnet, dict, file, and ldap. curl also supports HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading HTTP form based upload, proxies, cookies.

You can read more about these in http://php.net/

Monday, July 26, 2010

days difference in php

$date2 = '2010-06-20';
$date1 = '2010-06-24';
$days = (strtotime($date1) - strtotime($date2)) / (60 * 60 * 24);
echo $days;

some other ways are also there. can any one reply as a comments