Showing posts with label curl. Show all posts
Showing posts with label curl. Show all posts

Wednesday, March 19, 2008

PHP5 get http response body using CURL library

get response body of specified web page using php5, such as google homepage.

<?php
ob_start();

$ch = curl_init("http://www.google.com/");
curl_exec($ch);
curl_close($ch);
$retrievedhtml = ob_get_contents();
ob_end_clean();
// ob_end_flush();

echo $retrievedhtml;
?>