PHP Development-online image search code sharing

Source: Internet
Author: User
In this section, we will implement a small online image search function. does it sound very high? Of course, we don't want to implement an image search engine, but we need to stand on the shoulders of giants and implement it using APIs. Our goal is to study PHP development! First, create an html page to easily implement the input and submit search functions: index.html code: Image search text search image text search: in this section we come to implement a small function of online # css/css-rwd-images.html "target =" _ blank "> Image Search, does it sound very high? Of course, we don't want to implement an image search engine, but we need to stand on the shoulders of giants and implement it using APIs. Our goal is to study PHP development!

First, create an html page to easily implement the input and submit search functions:

The index.html code is as follows:

    
   Image search              

To post data to the search. php interface, you need to implement search. php:

 Data-> ResultArray; var_dump ($ result); $ url = $ result [0]-> ObjUrl; var_dump ($ url ); // jump to the image URL in the browser $ redirect = "Location :". $ url; header ($ redirect);?>

Here we call the text search API for image search. For more information, see Baidu

API stroe:http://apistore.baidu.com/apiworks/servicedetail/1557.html

Is a free API, but there is a limit on the number of calls. We only need to apply for apikey and fill in the above code to work properly.

Demo:

The above is the PHP Development entry-online image search code sharing details, please pay attention to other articles related to the first PHP community!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.