msgbartop
I will happily conduct a FREE basic web security scan for any genuine organization interested in my services to point out whether or not I can find vulnerabilities in your application. Just contact me.
Need a PHP Programmer, PHP staff or project manager? Contact me now.
msgbarbottom

07 Apr 10 PHP and curl

Using curl with PHP is incredibly easy. Firstly you’ll need to make sure that you have the PHP curl library installed on your system. On Debian, this is as easy as apt-get install php5-curl

Now you can try the following:

<?php
$handle = curl_init();
curl_setopt($handle, CURLOPT_URL, “http://www.google.com/”);
curl_setopt($handle, CURLOPT_HEADER, 0);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($handle);
curl_close($handle);

print_r($output);
?>

You can also check http://uk.php.net/manual/en/function.curl-setopt.php to take a look at the other options that curl_setopt can take.

curl can also post data to the remote server via POST or GET and also has the ability to save and retransmit cookies.

Tags: ,



Leave a Comment

You must be logged in to post a comment.