Home > Backend Development > PHP Tutorial > I heard that there are many gods in mainland China. I want to solve the problem of curl grabbing web page data~

I heard that there are many gods in mainland China. I want to solve the problem of curl grabbing web page data~

WBOY
Release: 2016-07-25 09:12:09
Original
932 people have browsed it
                                                                                                      img src="http://sports.cbsimg.net/images/baseball/mlb/players/60x80/1961062.jpg"border="0">
          < td>Pitcher:M. Marriot |  # 48 RP< ;/span>
                                                                                           
                                                                                                                                                                    >0.1IP
                                                     
                                                                                         td>
                                                                                                                                                                                                                          
Due to work requirements, I need to crawl data from other people’s websites. I use php+ curl but I have no solution to the problem
I heard that there are many gods in the mainland, please help me, from The boy from Taiwan has been reading articles for three days.
The website is as follows:
First enter:
http://www.cbssports.com/mlb/scoreboard
Then, select the event that is currently being played below and click GAMETRACKER You can watch the live broadcast
The question is coming
Take this URL as an example: (When you see it, maybe the game is over)
ttp://www.cbssports.com/mlb/gametracker/live/MLB_20140527_TB@TOR

The program written by my brother is as follows:
$game=array();
$ch = curl_init();
$search1=$_GET['searcharg'];
$url="http://www.cbssports.com/mlb/gametracker/live/MLB_20140527_TB@TOR";
$cookie_jar =dirname(__FILE__)."/pic.cookie";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLO PT_USERAGENT,"Mozilla/ 5.0 (Windows NT 6.1) AppleWebKit/536.11 (KHTML, like Gecko)Chrome/20.0.1132.57 Safari/536.11");
$data = curl_exec($ch);
curl_close($ch) ;
preg_match_all('/(.*?)/is',$data,$teamCity);
….(Character String parsing)
Currently known issues:
Whether it is "save as new"save as or view Original file , some html that should appear have not appeared, for example:
The original website is:
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