cURL Simple Example in PHP
Posted by Raj
cURL Simple Example in PHP:
cURL allows you to connect and communicate to many different types of servers with many different types of protocols.
PHP Supports libcurl.
Example:
<?php
// initialize curl session
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "example.com"); // set url
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//return the transfer as a string
$output = curl_exec($ch);//output string
// close curl session
curl_close($ch);
?>
cURL allows you to connect and communicate to many different types of servers with many different types of protocols.
PHP Supports libcurl.
Example:
<?php
// initialize curl session
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "example.com"); // set url
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//return the transfer as a string
$output = curl_exec($ch);//output string
// close curl session
curl_close($ch);
?>
This entry was posted on October 4, 2009 at 12:14 pm, and is filed under
Curl,
curl functions,
curl in php,
curl in php5,
curl simple examples,
curl tutorials,
in php,
PHP,
PHP interview questions and answers
.You can leave a response, or trackback from your own site.