roberts9
asked on
PHP Search Help
Hi,
I would like to build a little search engine in the admin area, and also define the number of search results and display them($results).
I'm calling data from xml feed and then parse it.
Here is the query:
$url = "http://pf.tradedoubler.com/pf/pf?&keyword=$keywords&maxResults=$max";
$keywords would be the search term
$max would be the number of search returns
and the returned results parsed in:
$result .='<div><a href=\"$producturl\">$prod ucttitle</ a><br />$productprice</div>';
Thanks in advance
I would like to build a little search engine in the admin area, and also define the number of search results and display them($results).
I'm calling data from xml feed and then parse it.
Here is the query:
$url = "http://pf.tradedoubler.com/pf/pf?&keyword=$keywords&maxResults=$max";
$keywords would be the search term
$max would be the number of search returns
and the returned results parsed in:
$result .='<div><a href=\"$producturl\">$prod
Thanks in advance
ASKER
themrrobert, Thank you so much for your help
Here is the whole code i'm using:
<?php
$affid="";
$keywords="nikon";
$max=10;
$url = "http://pf.tradedoubler.com/pf/pf?a=$affid&keyword=$keywords&maxResults=$max";
$SafeQuery = urlencode($url);
$xml = simplexml_load_file($SafeQ uery);
foreach ($xml->product as $item) {
$productimage = $xml->imageUrl;
$producturl = $xml->productUrl ;
$producttitle = $xml->name;
$productprice = $xml->price ;
$result .='<div><img src=\"$productimage\"><br /><a href=\"$producturl\">$prod ucttitle</ a><br />$productprice</div>';
return $result;
?>
Here is the whole code i'm using:
<?php
$affid="";
$keywords="nikon";
$max=10;
$url = "http://pf.tradedoubler.com/pf/pf?a=$affid&keyword=$keywords&maxResults=$max";
$SafeQuery = urlencode($url);
$xml = simplexml_load_file($SafeQ
foreach ($xml->product as $item) {
$productimage = $xml->imageUrl;
$producturl = $xml->productUrl ;
$producttitle = $xml->name;
$productprice = $xml->price ;
$result .='<div><img src=\"$productimage\"><br /><a href=\"$producturl\">$prod
return $result;
?>
ASKER
I just forgot the } closing tag, before return $result;
ASKER
I just made a mistake, so i repost the code....i couldn't edit my question
<?php
$affid="";
$keywords="nikon";
$max=10;
$url = "http://pf.tradedoubler.com/pf/pf?a=$affid&keyword=$keywords&maxResults=$max";
$SafeQuery = urlencode($url);
$xml = simplexml_load_file($SafeQ uery);
foreach ($xml->product as $item) {
$productimage = $item->imageUrl;
$producturl = $item->productUrl ;
$producttitle = $item->name;
$productprice = $item->price ;
$result .='<div><img src=\"$productimage\"><br /><a href=\"$producturl\">$prod ucttitle</ a><br />$productprice</div>';
}
return $result;
?>
<?php
$affid="";
$keywords="nikon";
$max=10;
$url = "http://pf.tradedoubler.com/pf/pf?a=$affid&keyword=$keywords&maxResults=$max";
$SafeQuery = urlencode($url);
$xml = simplexml_load_file($SafeQ
foreach ($xml->product as $item) {
$productimage = $item->imageUrl;
$producturl = $item->productUrl ;
$producttitle = $item->name;
$productprice = $item->price ;
$result .='<div><img src=\"$productimage\"><br /><a href=\"$producturl\">$prod
}
return $result;
?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I can help you out with this no problem. If not through EE, then I have contact info in my profile.