Basic curl examplesOnce 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. Here is a simple example that uses the cURL functions to send a POST request: Example #1 Using PHP's cURL module to send a POST request Another example that uses the cURL functions to send a raw JSON POST request: Example #2 Using PHP's cURL module to send a JSON POST request Here is another example that uses the cURL functions to fetch the example.com homepage into a file: Example #3 Using PHP's cURL module to fetch the example.com homepage |