I checked previous similar threads but did not get any solution. I am trying to access image search result from bing image api
<form method="post" action="">
Type in a search:<input type="text" id="searchText" name="searchText"
value="<?php
if (isset($_POST['searchText']))
{
echo($_POST['searchText']);
}
else { echo('sushi');}
?>"/>
<input type="submit" value="Search!" name="submit" id="searchButton" />
<?php
if (isset($_POST['submit'])) {
$request = 'http://api.bing.net/json.aspx?Appid=t58HB/yo6AEdw7/AMUb4k9kjJv/JRGUNX4&sources=image&query='.urlencode( $_POST["searchText"]);
$response = file_get_contents($request);
$jsonobj = json_decode($response);
echo gettype($jsonobj);
echo('<ul ID="resultList">');
foreach($jsonobj->SearchResponse->Image->Results as $value)
{
echo('<li class="resultlistitem"><a href="' . $value->Url . '">');
echo('<img src="' . $value->Thumbnail->Url. '"></li>');
}
echo("</ul>");
} ?>
</form>
following this tut - http://www.bing.com/developers/s/APIBasics.html#_Using_the_API
Getting error:
Notice: Undefined property: stdClass::$Image in /opt/lampp/htdocs/tindex2.php on line 33
Notice: Trying to get property of non-object in /opt/lampp/htdocs/tindex2.php on line 33
Warning: Invalid argument supplied for foreach() in /opt/lampp/htdocs/tindex2.php on line 33
any suggestion much appreciable.