Home > Article > Backend Development > PHP uses curl to create a simple Baidu search
In the past few days, I have studied the curl library in php and made a simple Baidu search. First, enter the code
PHP uses curl to create a simple Baidu search(.*?)<\/a><\/h3>/s'; preg_match_all($pre,$data,$match); foreach ($match[1] as $k => $v) { ?>
After analyzing the URLs in Baidu searches, I found a pattern
https://www.baidu. com/s?wd=Search keyword
But I found that after using the https protocol, I could not obtain the data on Baidu, so I changed it to http://www.baidu.com?wd=Search keyword!!
The rendering is as follows:
The above is the entire content of this article. I hope it will be helpful to everyone’s learning, and I also hope that everyone will visit the PHP Chinese website.
For more articles related to PHP using curl to create a simple Baidu search, please pay attention to the PHP Chinese website!