Home > Backend Development > PHP Tutorial > Parsing PHP calls to existing search engines_PHP Tutorial

Parsing PHP calls to existing search engines_PHP Tutorial

WBOY
Release: 2016-07-21 15:03:14
Original
874 people have browsed it

Copy code The code is as follows:

$key = $_GET['key']; //Get Keywords
$select = $_GET['select']; //Get the search engine selection
switch($select) //Jump to different pages according to different search engines
{
case "google": //GOOGLE
$url = "http://www.google.com/search?q=".$key;
header("Location: $url");
break;
case "yahoo": //YAHOO
$url = "http://search.yahoo.com/search?p=".$key;
header("Location : $url ");
break;
case "baidu": Baidu
$url = "http://www.baidu.com/s?wd=".$key;
header( "Location: $url");
              break;                                                                           ;



The running results are shown in Figure 36-4.

Figure 36-4 PHP comprehensive search engine

After clicking the [Submit] button, you can see that the Yahoo website is opened and relevant search results are found, as shown in Figure 36-5.

Figure 36-5 Yahoo search results


http://www.bkjia.com/PHPjc/327855.html

www.bkjia.com

http: //www.bkjia.com/PHPjc/327855.htmlTechArticleCopy the code as follows: ?php $key = $_GET['key']; //Get keyword $ select = $_GET['select']; //Get the search engine selection switch($select) //Jump to... depending on the search engine
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template