note 58903 modified in function.curl-init by cece

From: Date: Sun, 20 Nov 2005 09:09:45 +0000
Subject: note 58903 modified in function.curl-init by cece
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-98844@lists.php.net to get a copy of this message
[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); ?> --was-- 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); ?> http://php.net/manual/en/function.curl-init.php

« previous php.notes (#98844) next »