Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Below is a script I use to generate a keywordlist from a search ----- theres one problem when I put in the main keyword to run the search off of- it does not add that main keyword to the list.
QUESTION: How can I get the main keyword used to perform the search with, to be added to the end result keyword list.
EXAMPLE: If I put in "models" as the search term it will return
Modeling
Model
Simulation
Supermodel
Modelling
THE PROBLEM IS THE WORD "models" SHOULD BE THERE TOO.Code: Select all
function getwords($myKey, $keys='') {
$search_it=str_replace(' ', '+', $myKey);
$keys = explode('+', strtolower($search_it.'+'.$keys));
$page = strtolower(file_get_contents("http://www.google.com/search?hl=en&q=~$search_it"));
preg_match_all("/<b>([a-z]+)<\/b>/i",$page,$matches);
$matches = array_unique(array_slice($matches[1],4));
$found = array();
foreach($matches as $key => $value) {
if(!in_array(strtolower($value), $keys))
$found[] = ucfirst(strtolower($value));
}
return $found;
}
$_POST['myKey'] = $_POST['findKey'];
$words = getwords($_POST['myKey']);
$iterations = $_POST['iter'];
for($i = 2; $i <= $iterations; $i++) {
foreach($words as $w) {
$disallow = $_POST['myKey'].'+'.implode('+', $words);
$words = array_unique(array_merge($words, getwords($w, $disallow)));
}
}
echo'<form action="sendfile.php" method="POST" name="allResult">';
$i=1;
foreach($words as $w){
echo "<input type=\"checkbox\" name=\"chk$i\" value=\"$w\">$w<br>";
$i++;
}
if(isset($_POST['findKey'])){
echo"<br><input type=\"submit\" name=\"submit\" value=\"Create Text File\">";
}
echo'</form>';
echo"There are $i Keywords.";feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]