Drezard Posted December 18, 2008 Share Posted December 18, 2008 I work as a Network Engineer and we get a number of customers who forgot their modem passwords. So, Im trying to write a Curl script (and slowly learning Curl as well). Ive written a test script, which is here: <?php // curl.php $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, 'http://www.rootedbox.info/curl/http-protocol/protected/'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_USERPWD, 'admin:password'); $output = curl_exec($curl); $info = curl_getinfo($curl); if ($info['http_code'] == 401) { echo "Password is incorrect"; } else { echo "Password is: password"; } curl_close($curl); ?> How do I make it so that it doesn't display the page returned.... So currently, when I run this script, it displays the "401 - Error" and then my "The password is...." bit. I want it ONLY to display the "The password is..." bit. Daniel Link to comment https://forums.phpfreaks.com/topic/137491-basic-curl-question/ Share on other sites More sharing options...
xtopolis Posted December 18, 2008 Share Posted December 18, 2008 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($resource, $option, $value); $ch needs to be $curl to refer to your cURL resource. That should fix it. Link to comment https://forums.phpfreaks.com/topic/137491-basic-curl-question/#findComment-718557 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.