Salve, ho un problema con uno script di questo sito: http://www.stylegala.com/articles/ma..._standards.htm
Ho scaricato tutto e ho inserito i files nella cartella search nel mio sito: http://vcommunity.altervista.org/search/
Purtroppo però non trova nessun risultato.. come mai?
PS: ecco l'index.php
Cosa devo modificare per farlo funzionare? Grazie.Codice:<?php ################################################################################################## # XHTML Google search engine using Google API and NuSOAP library # Get the NuSOAP lib at http://cvs.sourceforge.net/viewcvs.py/nusoap/lib/ # Example tutorial by David Hellsing for stylegala.com # You can use this script on your site free of charge, no strings attached. # Please link back to http://www.stylegala.com if you use this script. # Donations are always welcome - contact us for details at info[at]stylegala.com ################################################################################################## ############ PREFERENCES ############ $pref->text = ""; # Default text if no description is returned $pref->title = "vCommunity Search"; # Default text if no title is returned $pref->key = "ABQIAAAANvnwioFWJ-UNM1_Yg3UOwBRVeFeubvrOAWCLObVIwUFGyXZMwhQlcxeQL15mKm921vKh2KxI82gMuw"; # your google API key, get yours at https://www.google.com/accounts/NewAccount $pref->results = "10"; # number of results (max 10) $pref->start = "auto"; # search number to be displayed first. "auto" will generate a navigation page $pref->safe = "true"; # toggles safeSearch on/off (false to turn if off) $pref->filter = "true"; # true if you wish google to filter out similar results ##################################### # load the NuSOAP php library require_once('nusoap.php'); # load the GET variable $query = $_GET['q']; # get the google results $results = getResults($query); # get document title $title = getTitle($query); ##################################### # FUNCTIONS START HERE function getTitle($query) { #gets a different title if there has been a search query $title = !empty($_GET['q']) ? "Risultati: ".$_GET['q'] : "vCommunity Search"; return $title; } function getResults($query) { # get preferences global $pref; if ($pref->start == "auto") $start = empty($_GET['start']) ? 0 : $_GET['start']; else $start = $pref->start; # Set parameters $parameters = array( 'key'=> $pref->key, 'q' => $query, 'start' => $start, 'maxResults' => $pref->results, 'filter' => $pref->filter, 'restrict' => '', 'safeSearch' => $pref->safe, 'lr' => '', 'ie' => 'latin', 'oe' => 'latin' ); # Create a new SOAP client, feeding it GoogleSearch.wsdl on Google's site $soapclient = new soapclient('http://api.google.com/GoogleSearch.wsdl', 'wsdl'); # query Google $results = $soapclient->call('doGoogleSearch',$parameters); # Results? $trans = get_html_translation_table(HTML_ENTITIES); # get html translations $amount = $results['estimatedTotalResultsCount']; if ( is_array($results['resultElements']) ) { $html = "<p class=\"results\">Risultati <strong>".($start+1)." - ".($start+$pref->results)."</strong> su circa <strong>$amount</strong> per <strong>$query</strong></p>\n"; $html.= "<dl>\n"; foreach ( $results['resultElements'] as $result ) { $snippet = $result['snippet'] ? $result['snippet'] : $pref->text; $snippet = preg_replace("/<b>([^<]+)<\/b>/","<strong>\\1</strong>",strip_tags($snippet,"<b>")); $url = preg_replace("/&/","&",$result['URL']); $title = $result['title'] ? $result['title'] : $pref->title; $title = preg_replace("/<b>([^<]+)<\/b>/","<strong>\\1</strong>",strip_tags($title,"<b>")); $html.= "\t<dt><a href=\"$url\">$title</a></dt>\n"; $html.= "\t<dd>$snippet</dd>\n"; $html.= "\t<dd class=\"url\">".preg_replace("/http\:\/\//","",$url)." - ".$result['cachedSize']."</dd>\n"; } $html.= "</dl>\n"; } # else no results elseif (!empty($query)) $html = "<p>La ricerca per <b><q>$query</q></b> non ha prodotto risultati.</p>"; # This will present a navigation, if start is set to auto if ($pref->start == "auto" && !empty($query) && $amount != 0) { $disp = $_GET['start']; if(!empty($disp) && $disp > 1) { $pag = $disp>($pref->results-1) ? $disp - $pref->results : 0; $prev = "<strong><a href=\"".$_SERVER['PHP_SELF']."?q=$query&start=$pag\">Precedente</a></strong> "; } if ($amount - $disp > $pref->results) { $pag = $disp+$pref->results; $next = "<strong><a href=\"".$_SERVER['PHP_SELF']."?q=$query&start=$pag\">Successivo</a></strong> "; } if ($amount > $pref->results) { $html.="<p class=\"nav\">Risultati: $prev"; if ($disp>0) { $be_disp = $disp >=($pref->results*10) ? ($disp/$pref->results)-($pref->results-1) : 1; for ($x=$be_disp;$x<(($disp/$pref->results)+1);$x++) { $html.="<a href=\"".$_SERVER['PHP_SELF']."?q=$query&start=".(($x-1)*$pref->results)."\">$x</a> "; } } $to_disp = floor($amount/$pref->results) > $pref->results ? ($disp/$pref->results)+11 : (floor($amount/$pref->results)+1); for($x=(($disp/$pref->results)+1); $x<$to_disp; $x++) { $html.= ($x-1)*$pref->results == $disp ? "<span>$x</span> " : "<a href=\"".$_SERVER['PHP_SELF']."?q=$query&start=".(($x-1)*$pref->results)."\">$x</a> "; } $html.=$next."</p>\n"; } } return $html; } ### END PHP ### ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title><?php echo $title; ?></title> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"></meta> <style type="text/css" media="all"> /* reflects somewhat googles default style. Modify as you wish. */ * { margin: 0; padding: 0; } body { font: 0.85em/1.15em arial, sans-serif; margin: 3em; } a:link { color: #00c } a:visited { color: #551a8b; } a:active { color: #f00; } dt { font-weight: normal; font-size: 1.2em; margin-top: 1.2em;} dd.url { color: #008000; } form { margin-bottom: 1.5em; padding-bottom: 1.5em; border-bottom: 1px solid #aaa; } p.nav { margin-top: 1.5em; padding-top: 1.5em; border-top: 1px solid #aaa;} p.nav a:link, p.nav a:visited, p.nav a:active { color: #000; margin-right: 0.3em; } p.nav strong { font-size: 1.3em; } p.nav strong a:link, p.nav strong a:visited, p.nav strong a:active { color: #00c; } p.nav span { color:#a90a08; font-weight: bold; margin-right: 0.3em; } </style> </head> <body> <form method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <p><label for="q"><b>vCommunity Search:</b></label> <input type="text" value="<?php echo $_GET['q']; ?>" name="q" id="q" /> <input type="submit" value=" Cerca nel web " /></p> </form> <?php echo $results; ?> </body> </html>
Edit: Il file index.php è stato tradotto da me in italiano

LinkBack URL
About LinkBacks
