Hello
I am getting this error <b>"The request failed"</b> my script works
fine with images,news,video and webs but not working for product
search. Please help me to solve this problem. My script is given below
$request
='http://api.shopping.yahoo.com/ShoppingService/v1/userproductreview?
catalogid=1991368668&appid=YahooDemo&results=5';
$response = file_get_contents($request);
if ($response === false) {
die('The request failed');
}
//echo htmlspecialchars($response, ENT_QUOTES);
// Create a new DOM object
$dom = new DOMDocument('1.0', 'UTF-8');
// Load the XML into the DOM
if ($dom->loadXML($response) === false)
{
die('Parsing failed');
}
$i = 0;
foreach ($dom->documentElement->childNodes as $articles)
{
//if node is an element (nodeType == 1) and the name is "item"
loop further
if ($articles->nodeType == 1 && $articles->nodeName == "Review")
{
foreach ($articles->childNodes as $n)
{
$subnodes = $articles->childNodes;
if($n->hasChildNodes())
{
foreach($n->childNodes as
$fcn)
{
if($fcn->hasChildNodes
())
{
foreach($fcn-
>childNodes as $second_n)
{
if
($second_n->hasChildNodes())
{
foreach($second_n->childNodes as $third_n)
{
$res[$i]
[$articles->nodeName][$n->nodeName][$fcn->nodeName][$second_n-
>nodeName]=trim($third_n->nodeValue);
}
}
else
$res
[$i][$articles->nodeName][$n->nodeName][$fcn->nodeName]=trim
($second_n->nodeValue);
}
}
else
$res[$i][$articles-
>nodeName][$n->nodeName]=trim($fcn->nodeValue);
}
}
else
$res[$i][$articles->nodeName]=trim($n-
>nodeValue);
$i++;
}
}
}
echo '<pre>';
print_r($res);
echo '</pre>';
?>
I uploaded this script at http://www.auctionsminer.com/yahoo.php
Server information is available at
http://www.auctionsminer.com/info.php