Detailed explanation of php calls to existing search engines

怪我咯
Release: 2023-03-12 16:34:01
Original
1794 people have browsed it

This article is a detailed analysis and introduction of PHP's calls to the existing search index. Friends in need can refer to it

The code is as follows:

<?php 
    $key = $_GET[&#39;key&#39;];                        //获得关键字 
    $select = $_GET[&#39;select&#39;];                  //获得搜索引擎的选择 
    switch($select)                             //根据搜索引擎的不同跳转到不同的页面 
    { 
        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":                           //百度 
            $url = "http://www.baidu.com/s?wd=".$key; 
            header("Location: $url"); 
            break; 
        default:                                //如果搜索引擎不存在,结束程序 
            break; 
    } 
?>
Copy after login

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 were found, as shown in Figure 36-5.


Figure 36-5 Yahoo search results

The above is the detailed content of Detailed explanation of php calls to existing search engines. For more information, please follow other related articles on the PHP Chinese website!

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!