Thursday, November 25, 2010

Use cURL module in PHP to create excellent tools


In my previous post, I had written about the importance and benefits of automating the tasks. In this post I am going to write about cURL which plays an important role in automating the tasks involving interaction between many web sites.

Curl  (Client for URLs) is free and open software that compiles and runs under a wide variety of operating systems.

It is available as  cURL command line tool or as libcurl  library.

It is useful to transfer data from or to a server, using one of the supported protocols (HTTP, HTTPS, FTP, FTPS, SCP, SFTP, TFTP, DICT, TELNET, LDAP or FILE)

curl offers lot of useful tricks like proxy support, user authentication, FTP upload, HTTP post, SSL connections, cookies, file transfer resume and much more.

curl is powered by libcurl for all transfer-related features. libcurl is free, thread-safe, IPv6 compatible, feature rich, well supported and fast.

libcurl is most probably the most portable, most powerful and most often used C-based multi-platform file transfer library on this planet - be it open source or commercial.


Using cURL you can:
  • Implement payment gateways’ payment notification scripts.
  • Download and upload files from remote servers.
  • Login to other websites and access members only sections.
Once you've compiled PHP with cURL support, you can begin using the cURL functions.

You can find below the cURL related functions in php.



You can play this Game to learn these cURL functions interestingly.


The basic idea behind the cURL functions is that you initialize a cURL session using the curl_init(), then you can set all your options for the transfer via the curl_setopt(), then you can execute the session with the curl_exec() and then you finish off your session using the curl_close(). Here is an example that uses the cURL functions to fetch qualitypointtech.com  homepage into a file.

<?php

$ch = curl_init("http://www.qualitypointtech.com/");
$fp = fopen("qualitypoint_homepage.txt", "w");

curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);

curl_exec($ch);
curl_close($ch);
fclose($fp);
?>



You can find here some of the applications written in  PHP/CURL

    We can do lot of things using cURL including managing cookies. I may be writing separate post to explain in detail.

     Our Team is having good experience in php especially using cURL.

    We had done many challenging projects using cURL. Our automatic resume posting project is an excellent project with lot of challenges. We were able to develop this application for automatically posting resume to around 70 US based job sites.

    If you want to develop any similar application you can contact me. (For example, if you are in UK you may be interested to do the samething for UK based job sites).

    Or, contact me if you want to know about any other business opportunity using cURL (e.g Twitter application, News extraction, SEO tools, key word analysis, autopilot scripts, small music/movie search engine, automatic social bookmarking posting, etc)

    More Articles...
    You can bookmark this blog for further reading, or you can subscribe to our blog feed.

    No comments:

    Search This Blog