GIrish BM Posted January 5, 2010 Share Posted January 5, 2010 Hi i am using curl in order to achieve the domain search in my web page, i am getting following error Warning: curl_exec() [function.curl-exec]: Could not call the CURLOPT_HEADERFUNCTION in C:\wamp\www\project\sri\index.php on line 38 here is my php script //-----------------------------------------------------------------------------------------------------------------------------------------------------// <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html> <title>PBMInfotech-Domain Search</title> <link rel="stylesheet" href="css/style.css" type="text/css" /> <body> <form method="POST" action=""> <table> <tr><td> Domain name: <input type="text" name="domain"></td></tr> <tr><td> <input type="checkbox" name="tld[]" checked value=".com"/>.com <input type="checkbox" name="tld[]" value=".org"/>.org <input type="checkbox" name="tld[]" value=".net"/>.net <input type="checkbox" name="tld[]" value=".info"/>.info <input type="checkbox" name="tld[]" value=".mobi"/>.mobi <input type="checkbox" name="tld[]" value=".eu"/>.eu </td></tr> <tr> <td> <input type="checkbox" name="tld[]" value=".me"/>.me <input type="checkbox" name="tld[]" value=".in"/>.in </td> </tr> <tr><td><input type="submit" name="submitBtn" value="Check domain"/></td></tr> </table> </form> </body> </html> <?php function url_exists($strURL) { $resURL = curl_init(); curl_setopt($resURL, CURLOPT_URL, $strURL); curl_setopt($resURL, CURLOPT_BINARYTRANSFER, 1); curl_setopt($resURL, CURLOPT_HEADERFUNCTION, 'curlHeaderCallback'); curl_setopt($resURL, CURLOPT_FAILONERROR, 1); curl_exec ($resURL); $intReturnCode = curl_getinfo($resURL, CURLINFO_HTTP_CODE); curl_close ($resURL); IF ($intReturnCode != 200 && $intReturnCode != 302 && $intReturnCode != 304) { RETURN FALSE; } ELSE { RETURN TRUE; } } if(isset($_POST['domain'])) { $arr = $_POST['tld']; foreach($arr as $var => $val) { echo url_exists($_POST['domain'].$val); } } ?> //-----------------------------------------------------------------------------------------------------------------------------------------------------// [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/187213-domain-search-using-curl-in-php/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.