Code: Select all
<?
error_reporting (0);
$search = str_replace ('\\', '', $search);
$query = str_replace (' ', '+', $search);
if ($theme == 'fr')
{
$request = '' . 'http://search.msn.fr/results.aspx?q=' . $query . '&format=rss&FORM=RSRE&count=' . $NumberItems . '&first=' . $showmin;
}
else
{
if ($theme == 'de')
{
$request = '' . 'http://search.msn.de/results.aspx?q=' . $query . '&format=rss&FORM=RSRE&count=' . $NumberItems . '&first=' . $showmin;
}
else
{
if ($theme == 'it')
{
$request = '' . 'http://search.msn.it/results.aspx?q=' . $query . '&format=rss&FORM=RSRE&count=' . $NumberItems . '&first=' . $showmin;
}
else
{
if ($theme == 'pt')
{
$request = '' . 'http://search.live.com/results.aspx?q=' . $query . '&first=' . $showmin . '&FORM=PERE&format=rss&mkt=pt-pt';
}
else
{
if ($theme == 'no')
{
$request = '' . 'http://search.msn.no/results.aspx?q=' . $query . '&format=rss&FORM=RSRE&count=' . $NumberItems . '&first=' . $showmin;
}
else
{
if ($theme == 'es')
{
$request = '' . 'http://search.msn.es/results.aspx?q=' . $query . '&format=rss&FORM=RSRE&count=' . $NumberItems . '&first=' . $showmin;
}
else
{
if ($theme == 'be')
{
$request = '' . 'http://search.msn.be/results.aspx?q=' . $query . '&format=rss&FORM=RSRE&count=' . $NumberItems . '&first=' . $showmin;
}
else
{
if ($theme == 'nz')
{
$request = '' . 'http://search.msn.com/results.aspx?q=' . $query . '&format=rss&mkt=en-nz&FORM=RSRE&count=' . $NumberItems . '&first=' . $showmin;
}
else
{
$request = '' . 'http://search.msn.com/results.aspx?q=' . $query . '&format=rss&mkt=en-US&FORM=RSRE&count=' . $NumberItems . '&first=' . $showmin;
}
}
}
}
}
}
}
}
$session = curl_init ($request);
curl_setopt ($session, CURLOPT_HEADER, true);
curl_setopt ($session, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec ($session);
curl_close ($session);
$status_code = array ();
preg_match ('/\\d\\d\\d/', $response, $status_code);
switch ($status_code[0])
{
case 200:
{
break;
}
case 503:
{
exit ('Your call to Yahoo Web Services failed and returned an HTTP status of 503. That means: Service unavailable. An internal problem prevented us from returning data to you.');
break;
}
case 403:
{
exit ('Your call to Yahoo Web Services failed and returned an HTTP status of 403. That means: Forbidden. You do not have permission to access this resource, or are over your rate limit.');
break;
}
case 400:
{
exit ('Your call to Yahoo Web Services failed and returned an HTTP status of 400. That means: Bad request. The parameters passed to the service did not match as expected. The exact error is returned in the XML response.');
break;
}
default:
{
exit ('Your call to Yahoo Web Services returned an unexpected HTTP status of:' . $status_code[0]);
}
}
if (!$xml = strstr ($response, '<?xml'))
{
$xml = null;
}
$filename1 = 'templates/' . $theme . '/external_msn_listing.txt';
$handle = fopen ($filename1, 'rb');
$SITETEMPLATE = fread ($handle, filesize ($filename1));
fclose ($handle);
list ($xml1, $xml2) = split ('</copyright>', $xml);
if (preg_match ('/<totalResultsAvailable>(.*)<\\/totalResultsAvailable>/s', $xml, $matches))
{
$DATAHITS2 = $matches[1];
}
if (preg_match ('/<firstResultPosition>(.*)<\\/firstResultPosition>/s', $xml, $matches))
{
$startrank = $matches[1];
}
$pieces = explode ('</item>', $xml2);
foreach ($pieces as $val)
{
if ($showhits != $Conf['listhits'])
{
$cutoffmsn = '' . $startrank;
}
else
{
$cutoffmsn = '' . $DATAHITS;
}
if ($cutoffmsn <= 9)
{
if (preg_match ('/<title>(.*)<\\/title>/s', $val, $matches))
{
$title = $matches[1];
}
if (preg_match ('/<description>(.*)<\\/description>/s', $val, $matches))
{
$description = $matches[1];
}
if (preg_match ('/<pubDate>(.*)<\\/pubDate>/s', $val, $matches))
{
$pubdate = $matches[1];
}
if (preg_match ('/<Destinations>(.*)<\\/Destinations>/s', $val, $matches))
{
$destinations = $matches[1];
}
if (preg_match ('/<UserPhotoURL>(.*)<\\/UserPhotoURL>/s', $val, $matches))
{
$photourl = $matches[1];
}
if (preg_match ('/<link>(.*)<\\/link>/s', $val, $matches))
{
$url = $matches[1];
}
if ($title != '')
{
++$DATAHITS;
++$startrank;
if ($showhits != $Conf['listhits'])
{
$ch = $showhits - $Conf['listhits'];
}
else
{
$ch = $showhits - $Conf['listhits'] + $forrage;
}
$rank = $ch + $startrank;
$title = str_replace (''', '\'', $title);
$description = str_replace (''', '\'', $description);
$SITETEMPLATE2 = $SITETEMPLATE;
$SITETEMPLATE2 = str_replace ('<module:photo>', $photourl, $SITETEMPLATE2);
$SITETEMPLATE2 = str_replace ('<module:destinations>', $destinations, $SITETEMPLATE2);
$SITETEMPLATE2 = str_replace ('<module:pubdate>', $pubdate, $SITETEMPLATE2);
$SITETEMPLATE2 = str_replace ('<module:state>', $state, $SITETEMPLATE2);
$SITETEMPLATE2 = str_replace ('<module:phone>', $phone, $SITETEMPLATE2);
$SITETEMPLATE2 = str_replace ('<module:detailsurl>', $moreinfourl, $SITETEMPLATE2);
$SITETEMPLATE2 = str_replace ('<module:mapurl>', $mapurl, $SITETEMPLATE2);
$SITETEMPLATE2 = str_replace ('<module:distance>', $distance, $SITETEMPLATE2);
if ($showthumbs == '1')
{
$SITETEMPLATE2 = str_replace ('<module:thumbshots>', '' . '<img src="http://open.thumbshots.org/image.pxf?url=' . $url . '" width=90 height=66>', $SITETEMPLATE2);
}
$SITETEMPLATE2 = str_replace ('<module:site>', $url, $SITETEMPLATE2);
if ($url != '')
{
$SITETEMPLATE2 = str_replace ('<module:fullsite>', $url, $SITETEMPLATE2);
}
else
{
$SITETEMPLATE2 = str_replace ('<module:fullsite>', $moreinfourl, $SITETEMPLATE2);
}
$SITETEMPLATE2 = str_replace ('<module:num>', $num, $SITETEMPLATE2);
$SITETEMPLATE2 = str_replace ('<module:cgiurl>', $Conf['cgiurl'], $SITETEMPLATE2);
$SITETEMPLATE2 = str_replace ('<module:date>', $d1, $SITETEMPLATE2);
$SITETEMPLATE2 = str_replace ('<module:rank>', $rank, $SITETEMPLATE2);
$SITETEMPLATE2 = str_replace ('<module:hits>', $thehits, $SITETEMPLATE2);
$SITETEMPLATE2 = str_replace ('<module:rating>', $rating, $SITETEMPLATE2);
$SITETEMPLATE2 = str_replace ('<module:votes>', $votes, $SITETEMPLATE2);
$SITETEMPLATE2 = str_replace ('<module:imageurl>', $Conf['imgdir'] . '/' . $theme, $SITETEMPLATE2);
$SITETEMPLATE2 = str_replace ('<module:description>', $description, $SITETEMPLATE2);
$SITETEMPLATE2 = str_replace ('<module:title>', $title, $SITETEMPLATE2);
if ($url != '')
{
$SITETEMPLATE2 = str_replace ('<module:url>', $url, $SITETEMPLATE2);
}
else
{
$SITETEMPLATE2 = str_replace ('<module:url>', $moreinfourl, $SITETEMPLATE2);
}
$SITETEMPLATE2 = str_replace ('<module:new>', $newimage, $SITETEMPLATE2);
$SITETEMPLATE2 = str_replace ('<module:imageurl>', $Conf['imgdir'], $SITETEMPLATE2);
$feedmsn .= '' . $SITETEMPLATE2;
continue;
}
continue;
}
}
?>
Tom.