CURL is Short for Client URL. It "allows you to connect and communicate to many different types of servers with many different types of protocols." Basically it allows you to recieve content from other websites.
However using die() to output the contents is generally not a good practice. Usually one would echo the output.
Here is a better example:
<?php
// Initialize CURL resource $cURL = curl_init();
// set URL and other appropriate options
curl_setopt($cURL, CURLOPT_URL,"http://www.myurl.com"); //tells CURL we are going to use POST to send the parameters
curl_setopt($cURL, CURLOPT_POST, true); // tells CURL not to pass the output directly to the browser
curl_setopt($cURL, CURLOPT_RETURNTRANSFER, true);
// set parameters
curl_setopt($cURL, CURLOPT_POSTFIELDS, "foo=1&bar=2");
my personal blog:
www.sanbaldo.com
http://php.net/curl
However using die() to output the contents is generally not a good practice. Usually one would echo the output.
Here is a better example:
<?php
// Initialize CURL resource
$cURL = curl_init();
// set URL and other appropriate options
curl_setopt($cURL, CURLOPT_URL,"http://www.myurl.com");
//tells CURL we are going to use POST to send the parameters
curl_setopt($cURL, CURLOPT_POST, true);
// tells CURL not to pass the output directly to the browser
curl_setopt($cURL, CURLOPT_RETURNTRANSFER, true);
// set parameters
curl_setopt($cURL, CURLOPT_POSTFIELDS, "foo=1&bar=2");
// grab URL, return output
$ouput = curl_exec($cURL);
// close CURL resource
curl_close($cURL);
//print the output
echo $output;
?>