<?php  //Ian Bugeja 2005
        
$page $_REQUEST['page'];
        if (
$page == ""$page 0;
                    
        
$query $_REQUEST['ahnaralso'];
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
    <title>AHNAR See Also</title>
    <link rel="stylesheet" href="ahnarstyle.css">
</head>

<body class="ahnarbody">

    <table class="ahnartable" align="center">
        <tr><td class="ahnarlarge">AHNAR... <span style="font-size:small; font-weight:bold">See Also</span></td>
                    <td style="text-align: right"><span style="font-size:x-small"><a href="correct.php" target="_blank">[Correct]</a>
                    <a href='javascript: window.location.reload()'>[Refresh]</a>
                    <a href="seealso.php">[See Also]</a>
                    </span></td>
                </tr>
        <tr><td colspan="2"><hr class="ahnarlarge"></td></tr>
        <tr><td colspan="2" style="text-align:right">Powered by <a href="http://www.google.com"><img src="google.gif" alt="Google"></a></td></tr>
        <tr><td colspan="2">Search Query:
            <?php echo $query?>    
        </td></tr>
        <tr><td colspan="2" style="text-align:right">Page: <?php $p $page +1;  echo $p?></td></tr>
        <tr>
        <td colspan="2">
        
<?php
    $start 
$page 4;
    
    
$sclient = new SoapClient("GoogleSearch.wsdl");
    
    
$devkey 'eA7/tWdQFHJlWnI0wewzJLI8qqhJCvrK'//my google's developer key
    
    
if ($query == '') die("<br><br>Error Missing parameter ahnaralso<br><br>");
    
    
$params = array(
                
'key' => $devkey// the Developer's key
                
'q' => $query// the search query
                
'start' => $start// the point in the search results should Google start
                
'maxResults' => 4// the number of search results (max 10)
                
'filter' => false// should the results be filtered?
                
'restrict' => '',
                
'safeSearch' => false,
                
'lr' => 'lang_en',
                
'ie' => '',
                
'oe' => ''
        
);
    
        
$NoExceptionflag true;
        try
    {
        
$response $sclient->__SoapCall("doGoogleSearch"$params);
    }
    catch (
SoapFault $exception)
    {
                echo 
"Error in contacting Google Web Service: <br>";
                echo 
"<a href='javascript: window.location.reload()'>Retry</a><br><br>";
                echo 
$exception;
                
$NoExceptionflag false;
    }

        if (
$NoExceptionflag)
        {
                if (
count($response->resultElements) == 0) echo "<br><br>Sorry No Results Found<br><br>";

            foreach(
$response->resultElements as $result)
            {
                        if (
$result->title != "")
                        {
                                echo 
"<a href='ahnar.php?ahnarurl=$result->URL' target='_blank'>$result->title</a><br>";
                        echo 
$result->summary.'<br>';
                        echo 
$result->snippet.'<br>';
                        echo 
"<span class='ahnarmedium'>".$result->URL."</span><br>";

                        echo 
"<br><br>";
                        }
            }
        }
?>


        </td>
        </tr>
        <tr><td colspan="2">&nbsp;</td></tr>
        <tr><td colspan="2" style="text-align:center">Page
        <?php
                        
if ($NoExceptionflag)
                        for(
$i=0$i 5$i++)
            {
                
$i1 $i 1;
                if (
$i == $page) echo " [";
                echo 
" <a href='google.php?ahnaralso=$query&page=$i'>$i1</a> ";
                if (
$i == $page) echo "] ";
            }
        
?>
        </td></tr>
        <tr><td colspan="2">&nbsp;</td></tr>
        <tr><td colspan="2" class="ahnarsmall">Ian Bugeja 2005, University of Malta, CSA3004, APT</td></tr>
    </table>


</body>
</html>