Forum Moderators: coopster
<?
/**
* Uses the Services_Technorati package
*/
require_once 'Services/Technorati.php';
// Replace this with your API key
$myApiKey = 'b680ff4d82f7a63c4ef9dce939f407ca';
// Create a new instance based on your key
$technorati = Services_Technorati::factory($myApiKey);
// Specify further options for the search
// We limit the result to ten links
$options = array('limit' => 10);
//Search blogs linking to the PEAR website
$result = $technorati->cosmos('http://pear.php.net', $options);
// Display some basic information
print "Searching for blogs that link to http://pear.php.net\n\n";printf("Number of blogs found: %d\n", $result['document']['result']['inboundblogs']);
printf("Number of links found: %d\n", $result['document']['result']['inboundlinks']);
// Iterate through the found links
print "\nFirst ten links:\n\n";
print_r($result['document']['item']);
foreach ($result['document']['item'] as $link)
{
printf("Link on %s to %s\n",
$link['weblog']['name'],
$link['linkurl']);
}
?>
But, when I run it in my web browser, there is a bug like this :
Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\pear\Technorati\tech.php on line 23
Please tell me how to fix it. Thank's