International PHP Conference 2015

Basic curl example

Once you've compiled PHP with cURL support, you can begin using the cURL functions. 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 the homepage into a file:

Example #1 Using PHP's cURL module to fetch the homepage


$fp fopen("example_homepage.txt""w");



add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top