0

Echo google problem
Please advice you inputs are greatly appreciated

<?php
if (empty($_GET['q'])){
echo "What are you doing?";
}
else 
{
/* getting value from the search form creating a new variable*/
$ser = $_GET['q'];
/* applying logic and creating a new variable to it*/
$logic = "~resume (filetype:pdf OR filetype:doc OR filetype:rtf OR filetype:htm OR filetype:html) KEYWORD -jobs -apply -submit -required -wanted -write -sample";
/* replacing KEYWORD*/
$logic = str_replace ("KEYWORD", "$ser", $logic);

$query = file_get_contents('http://www.google.com/search?q='.urlencode (['$logic']).'&start='.$_GET['p'].'00&num=100&hl=en&ie=UTF-8&filter=2');
echo $query;

}
?>
2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by j_limboo
0

This:
urlencode ()

Should be:
urlencode ($logic)...


Whole code:

<?php
if (empty($_GET['q'])){
echo "What are you doing?";
}
else 
{
/* getting value from the search form creating a new variable*/
$ser = $_GET['q'];
/* applying logic and creating a new variable to it*/
$logic = "~resume (filetype:pdf OR filetype:doc OR filetype:rtf OR filetype:htm OR filetype:html) KEYWORD -jobs -apply -submit -required -wanted -write -sample";
/* replacing KEYWORD*/
$logic = str_replace ("KEYWORD", "$ser", $logic);

$query = file_get_contents('http://www.google.com/search?q='.urlencode($logic).'&start='.$_GET['p'].'00&num=100&hl=en&ie=UTF-8&filter=2');
echo $query;

}
?>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.