I found 2, but both created loads of errors when ran on 'Easy PHP'.
I have no idea whether it's an error in the code, the fact I'm using Windows 7 64 bit, or because of a problem with Easy PHP, but was thinking if anybody could please check the code out and/or suggest any alternatives? Just a simple PHP script where I can paste hundreds of keywords in and it'll fire back if they're available for .ext such as org com net co.uk etc.
The errors it brings back include things such as:
I have no idea whether it's an error in the code, the fact I'm using Windows 7 64 bit, or because of a problem with Easy PHP, but was thinking if anybody could please check the code out and/or suggest any alternatives? Just a simple PHP script where I can paste hundreds of keywords in and it'll fire back if they're available for .ext such as org com net co.uk etc.
Code:
<?php
/* * PHP Exact Phrase Finder: Coded by Erik (aka TheGoat) for my friends at BHW.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
* YOU MAY NOT SELL THIS SOFTWARE!!!!!!
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* A copy of the GNU General Public License is not distributed
* with this program; If you would like one, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
?>
<html>
<head>
<title>Exact Phrase Finder</title>
</head>
<body>
<div align="center">
<?php
set_time_limit(9999999);
ob_start();
function chkDomain($domain,$whoisServer,$textToFind)
{
// Create a socket
$socketConnection = fsockopen($whoisServer, 43);
if (!$socketConnection) return false;
// Query the server with domain
fputs($socketConnection, $domain."\r\n");
// Read and store the server response
$serverResponse = ' :';
while(!feof($socketConnection))
{
$serverResponse .= fgets($socketConnection,128);
// echo $serverResponse;
}
// Close the socket
fclose($socketConnection);
// Check if the domain is available
if (strpos($serverResponse, $textToFind) || strpos($serverResponse, "No match for") || strpos($serverResponse, "NOT FOUND"))
{
return true;
}
else
{
return false;
}
}
// You must add an array element here for any additional TLDs.
$TLD["com"] = array('server' => "whois.crsnic.net",
'text' => "No match for");
$TLD["org"] = array('server' => "whois.publicinterestregistry.net",
'text' => "No match for");
$TLD["net"] = array('server' => "whois.crsnic.net",
'text' => "No match for");
$TLD["info"] = array('server' => "whois.afilias.info",
'text' => "NOT FOUND");
$TLD["co"] = array('server' => "whois.nic.co",
'text' => "Not found");
$TLD["co.uk"] = array('server' => "whois.nic.uk",
'text' => "No match for");
// check if form has been submitted
if (!isset($_POST['submit']))
{
// if not display form
echo "Select from the TLDs below: <br />
<form action=\"" . $_SERVER['PHP_SELF'] . "\" method=\"POST\">
com: <input type=\"checkbox\" value=\"com\" name=\"options[]\">Â Â Â Â
org: <input type=\"checkbox\" value=\"org\" name=\"options[]\">Â Â Â Â
net: <input type=\"checkbox\" value=\"net\" name=\"options[]\">Â Â Â Â
co: <input type=\"checkbox\" value=\"co\" name=\"options[]\">Â Â Â Â
co.uk: <input type=\"checkbox\" value=\"uk\" name=\"options[]\">Â Â Â Â
info: <input type=\"checkbox\" value=\"info\" name=\"options[]\">
<br /><br />
check with dashes: <input type=\"checkbox\" name=\"dashes\">
<br /><br />
One search term per line.
<br />
<textarea name=\"terms\" cols=80 rows=20 wrap=\"off\"></textarea><br />
<br /><br />
Capture data from a .csv file: <input type=\"checkbox\" name=\"adwords\">Â    delimeter: <input size=1 maxlength=1 type=\"text\" name=\"delimeter\" />
<br /><br />
<input type=\"submit\" name=\"submit\" value=\"Check Domains\">
</form>";
// output buffer
for($i=0;$i<1;$i++) { ob_flush(); flush(); usleep(300000); }
}
else
{
echo "<div align=\"left\">";
// form has been submitted
// check if any items were selected
// if so display them
if (is_array($_POST['options']))
{
$TLDCount = count($_POST['options']);
echo "Will scan $TLDCount TLD(s): <br />";
// output buffer
for($i=0;$i<1;$i++) { ob_flush(); flush(); usleep(300000); }
//use a foreach() loop to read and display TLDs
foreach ($_POST['options'] as $opt)
{
echo "<i>$opt</i><br />\n";
}
// initialize check the adwords value
if (isset($_POST['adwords']))
{
$delimeter = $_POST['delimeter'];
echo "\n<br />Checking the Adwords .csv file: <br /><br/>\n";
$adword_line = split("\n", $_POST['terms']); // create array from input, split be linespace
$uid = 0; // set id
foreach ($adword_line as $term_line)
{
/* for some reason, an encoded line brake is added at the end of the
first occurence of the loop. Very odd... but just strip it out for now... */
$term_line = trim($term_line);
if($term_line==NULL) { continue; }
echo "<i>$uid</i> - " . $term_line . "<br />\n";
$columns = explode("$delimeter", $term_line); // set delimeter and split into array
$cl_count = count($columns); // count the number of columns
echo "$cl_count columns in line $uid<br />";
echo "$columns[0]<br />";
$term_name = $columns[0];
$domain = str_replace(" ", "", "$term_name"); // Delete whitespace to create 2nd level domain portion
// loop TLDs for each domain
foreach ($_POST['options'] as $opt)
{
$fqdn = $domain . "." . $opt; // create FQDN from seperate domain portions
$whois_server = $TLD["$opt"]["server"]; // assign whois server
$find_text = $TLD["$opt"]["text"]; // assign unique string to find
if (chkDomain("$fqdn","$whois_server","$find_text")) // check if domain is availale
{
echo "<strong/>$fqdn = available</strong><br />\n";
$available[] = $fqdn;
$keynames[] = "$fqdn,$term_line";
}
else
{
echo "$fqdn = taken<br />\n";
}
// output buffer
for($i=0;$i<1;$i++) { ob_flush(); flush(); usleep(300000); }
}
$numWords = count(explode(" ",$term_name)); // count the number of words in each term
if ($numWords > 1 && isset($_POST['dashes']))
{
$domain = str_replace(" ", "-", "$term_name"); // Replace whitespace with a '-'
//use a foreach() loop TLDs
foreach ($_POST['options'] as $opt)
{
$fqdn = $domain . "." . $opt;
$whois_server = $TLD["$opt"]["server"];
$find_text = $TLD["$opt"]["text"];
if (chkDomain("$fqdn","$whois_server","$find_text"))
{
echo "<strong/>$fqdn = available</strong><br />\n";
$available[] = $fqdn;
$keynames[] = "$fqdn,$term_line";
}
else
{
echo "$fqdn = taken<br />\n";
}
// output buffer
for($i=0;$i<1;$i++) { ob_flush(); flush(); usleep(300000); }
}
}
echo "<br />\n";
// output buffer
for($i=0;$i<1;$i++) { ob_flush(); flush(); usleep(300000); }
$uid++;
}
if(count($available) > 0);
{
echo "<br />
<br />
Found these available domains:<br />";
foreach ($available as $found_domain)
{
echo "<strong>$found_domain</strong><br />\n";
}
echo "<br /><br />
<table width='100%'>";
//loop through all the input again gain
foreach ($keynames as $key_line)
{
echo "<tr>";
$blocks = explode("$delimeter", $key_line); // set delimeter and split into array
//echo "$key_line" . "<br />";
foreach ($blocks as $col)
{
echo "<td>$col</td>";
}
echo "</tr>";
}
echo "</table>";
}
}
else
{
echo "\n<br />Checking the search terms: <br /><br/>\n";
$search_terms = split("\n", $_POST['terms']); // create array from input, split be linespace
$search_terms = array_unique($search_terms); // remove duplicates
foreach ($search_terms as $term_name)
{
/* for some reason, an encoded line brake is added at the end of the
first occurence of the loop. Very odd... but just strip it out for now... */
$term_name = trim($term_name);
echo "<i>$term_name</i><br />\n";
$domain = str_replace(" ", "", "$term_name"); // Delete whitespace to create 2nd level domain portion
// loop TLDs for each domain
foreach ($_POST['options'] as $opt)
{
$fqdn = $domain . "." . $opt; // create FQDN from seperate domain portions
$whois_server = $TLD["$opt"]["server"]; // assign whois server
$find_text = $TLD["$opt"]["text"]; // assign unique string to find
if (chkDomain("$fqdn","$whois_server","$find_text")) // check if domain is availale
{
echo "<strong/>$fqdn = available</strong><br />\n";
$available[] = $fqdn;
}
else
{
echo "$fqdn = taken<br />\n";
}
// output buffer
for($i=0;$i<1;$i++) { ob_flush(); flush(); usleep(300000); }
}
$numWords = count(explode(" ",$term_name)); // count the number of words in each term
if ($numWords > 1 && isset($_POST['dashes']))
{
$domain = str_replace(" ", "-", "$term_name"); // Replace whitespace with a '-'
//use a foreach() loop TLDs
foreach ($_POST['options'] as $opt)
{
$fqdn = $domain . "." . $opt;
$whois_server = $TLD["$opt"]["server"];
$find_text = $TLD["$opt"]["text"];
if (chkDomain("$fqdn","$whois_server","$find_text"))
{
echo "<strong/>$fqdn = available</strong><br />\n";
$available[] = $fqdn;
}
else
{
echo "$fqdn = taken<br />\n";
}
// output buffer
for($i=0;$i<1;$i++) { ob_flush(); flush(); usleep(300000); }
}
}
echo "<br />\n";
// output buffer
for($i=0;$i<1;$i++) { ob_flush(); flush(); usleep(300000); }
}
if(count($available) == 0);
{
echo "<br />
<br />
Found these available domains:<br />";
foreach ($available as $found_domain)
{
echo "<strong>$found_domain</strong><br />\n";
}
}
}
}
else
{
echo "Nothing selected\n";
}
echo "</div>";
}
?>
</div>
</body>
</html>
Code:
[B]Deprecated[/B]: Function split() is deprecated in [B]C:\Program Files (x86)\EasyPHP-5.3.6.0\www\epf\index.php[/B] on line [B]248[/B]
Last edited: