• 如何在自己的网页中调用外部的搜索引擎:google、百度web接口


    很多的网页中都包含了百度和google的搜索链接,直接在本地网页中输入搜索关键字,就会在另一网页中打开搜索结果。google和百度都允许用户能过浏览器直接调用其搜索功能,只输通过一行简单的代码正确提交即可。

    下面是google的web调用接口:

    <form method=get action="http://www.google.com/search"  target="_blank"> <input type=text name=q size=40 maxlength=255 value=""><input type=submit name=btnG value="谷歌搜索"> </form>

    可以看出,这就是一个很简单的表单,只是注意method=get 和action="http://www.google.com/search" ,当然更有一个重点要特别强调,那就是input 文本框的name必须为q,否则提交会失败,返回google搜索首页。至于表单的位置,排版,随意即可。

    同理,百度的调用接口为:

    <form action="http://www.baidu.com/baidu" target="_blank"> <input type=text name=word size=40><input type="submit" value="百度搜索"> </form>

    注意输入搜索关键字的文本框name为word,不能为其它。

    自己乐乐。

    1 <form method=get action="http://www.google.com/search"  target="_blank">
    2     <input type=text name=q size=40 maxlength=255 >
    3     <input type=submit name=btnG value="谷歌搜索">
    4 </form>
    1 <form action="http://www.baidu.com/baidu" target="_blank">
    2     <input type=text name=word size=40>
    3     <input type="submit" value="百度搜索">
    4 </form>


     

  • 相关阅读:
    pymsql及事务
    MySQL表的操作
    MySQL操作
    epoll、mysql概念及简单操作
    IO模型
    面向对象4
    面向对象3
    面向对象2
    练习——网络编程2
    练习——网络编程
  • 原文地址:https://www.cnblogs.com/Wfei/p/2680635.html
Copyright © 2020-2023  润新知