note 58903 deleted from function.curl-init by didou
| From: | didou@php.net | Date: | Sun, 23 Apr 2006 23:19:55 +0000 |
| Subject: | note 58903 deleted from function.curl-init by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-109264@lists.php.net to get a copy of this message | ||
Note Submitter: MrBeeeenz (e_iad at hotmail dot com)
----
[Editor's note: You can use CURLOPT_RETURNTRANSFER to avoid output instead]
Just if you want to check URL exists on sites server.
<?php
$ch = curl_init("http://ca.php.net/manual/add-note.php");
// use output buffering instead of returntransfer -itmaybebuggy
ob_start();
curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
//Store data
//$retrievedhtml = ob_get_contents();
ob_end_clean();
//200 is meaning valid url as 404 meaning "not found on this server" etc..
if ($info['http_code']==200)
echo "URL is valid<hr>";
else
echo "URL is not valid<hr>";
print_r ($info);
?>