View Single Post
  #1 (permalink)  
Old 03-21-2004, 01:20 PM
edbarton's Avatar
edbarton edbarton is offline
Senior Member
Latest Blog:
None

 
Join Date: 10-13-03
Location: England
Posts: 1,757
iTrader: 0 / 0%
edbarton is just really niceedbarton is just really niceedbarton is just really niceedbarton is just really niceedbarton is just really niceedbarton is just really niceedbarton is just really niceedbarton is just really niceedbarton is just really niceedbarton is just really niceedbarton is just really nice
Next, previous, 1,2 links etc. for my Google SE

As part of my search engine I want to have next, previous and 1,2,3 up to 10 links which change based on search results etc. (like Google has)

Basically the current php looks like this

[code:1:bbbb50225d]
<?php
// include the class
include("nusoap.php");

# Create a new SOAP client, feeding it GoogleSearch.wsdl on Google's site
$soapclient = new soapclient('http://api.google.com/GoogleSearch.wsdl', 'wsdl');

// uncomment the next line to see debug messages
// $soapclient->debug_flag = 1;

// set up an array containing input parameters to be
// passed to the remote procedure
$params = array(
'key' => '-mygooglelicensekey-', // Google license key
'q' => $_GET['q'], // search term
'start' => 0, // start from result n
'maxResults' => 10, // show a total of n results
'filter' => true, // remove similar results
'restrict' => $_POST['restrict'], // restrict by topic
'safeSearch' => true, // remove adult links
'lr' => 'lang_en', // restrict by language
'ie' => '', // input encoding
'oe' => '' // output encoding
);

// invoke the method on the server
$result = $soapclient->call("doGoogleSearch", $params, "urn:GoogleSearch", "urn:GoogleSearch");

// print the results of the search
// if error, show error
if ($result['faultstring'])
{
?>
</p>
<? echo $result['faultstring'];?>
<?
}
else
{
// else show list of matches with links
?>
<p align="justify">Your search for <strong>
<?=$result['searchQuery']?>
</strong> produced
<?=$result['estimatedTotalResultsCount']?>
results. </p>
<?
if (is_array($result['resultElements']))
{
foreach ($result['resultElements'] as $r)
{
echo "<a href=" . $r['URL'] . ">" . $r['title'] . "</a>";
echo "<br />";
echo $r['snippet'] . "";
echo "<br />";
echo $r['URL'] . " - " . $r['cachedSize'] . " - ";
echo "<a href=retrieve.php?u=" . $r['URL'] . ">Cached</a>";
echo "<p>";
}
}
}
?>
[/code:1:bbbb50225d]

Basically you can only do one query at a time which involves 10 results, so I need links at the bottom to change this

[code:1:bbbb50225d]
'start' => 0, // start from result n
[/code:1:bbbb50225d]

to

[code:1:bbbb50225d]
'start' => 11, // start from result n
[/code:1:bbbb50225d]

etc. for each page
Reply With Quote