ryancanulla Posted September 3, 2010 Share Posted September 3, 2010 Hi there, Any help is greatly appreciated. I've commented out the code giving me trouble. Error = <br /> <b>Warning</b>: curl_setopt(): supplied argument is not a valid cURL handle resource in <b>/###.php</b> on line <b>34</b><br /> <br /> <b>Warning</b>: curl_setopt(): supplied argument is not a valid cURL handle resource in <b>/###.php</b> on line <b>35</b><br /> <?php $ch = curl_init(); $timeout = 30; $userAgent = $_SERVER['HTTP_USER_AGENT']; if ($_REQUEST['update']) { curl_setopt($ch, CURLOPT_URL, $_REQUEST['url']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); curl_setopt($ch, CURLOPT_USERPWD, $_REQUEST['username'] . ':' . $_REQUEST['password']); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($ch, CURLOPT_USERAGENT, $userAgent); //curl_setopt($c, CURLOPT_POST, true); //curl_setopt($c, CURLOPT_POSTFIELDS, $_REQUEST['update']); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); $response = curl_exec($ch); if (curl_errno($ch)) { echo curl_error($ch); } else { curl_close($ch); echo $response; } } Link to comment https://forums.phpfreaks.com/topic/212473-sending-post-to-a-page-with-http-auth/ Share on other sites More sharing options...
petroz Posted September 3, 2010 Share Posted September 3, 2010 Your using $ch on everything but those lines you commented.. your just using $c... Link to comment https://forums.phpfreaks.com/topic/212473-sending-post-to-a-page-with-http-auth/#findComment-1106983 Share on other sites More sharing options...
ryancanulla Posted September 3, 2010 Author Share Posted September 3, 2010 thank you sir! Link to comment https://forums.phpfreaks.com/topic/212473-sending-post-to-a-page-with-http-auth/#findComment-1106990 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.