Domain Search Using Curl in PHP
Posted: Mon Jan 04, 2010 11:51 pm
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
Request:-
I Have Tried Many Options like fopen in different way but i am unable to complete the task .so any one plz help me to achieve this task r u can send me the code if u have already done this to my mail address girish@pbminfotech.com , just give the link to me.
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);
}
}
?>
//-----------------------------------------------------------------------------------------------------------------------------------------------------//
Warning: curl_exec() [function.curl-exec]: Could not call the CURLOPT_HEADERFUNCTION in C:\wamp\www\project\sri\index.php on line 38
Request:-
I Have Tried Many Options like fopen in different way but i am unable to complete the task .so any one plz help me to achieve this task r u can send me the code if u have already done this to my mail address girish@pbminfotech.com , just give the link to me.
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);
}
}
?>
//-----------------------------------------------------------------------------------------------------------------------------------------------------//