cURL

Is cURL installed on my machine

apt-get install php5-curl

sudo service apache2 restart

 

Basic cURL call


// Define the url of the webservice.
define('CURL_URL', 'http://examples.dev/index.php');

/*
 * Basic cURL call.
 */
$ch = curl_init(CURL_URL);
// Return the response from the HTTP request as a string.
// If CURLOPT_RETURNTRANSFER is not set, cURL outputs the data immediately.
// Try commenting this line.
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$response = curl_exec($ch);
curl_close($ch);

print $response;

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.