php - Web scraping Google's Hotel Finder -


i'm trying teach myself how web scrape hotel data.

    <?php  $url = "https://www.google.com/hotels/#search;l=denpasar-bali+ngurah+rai,+denpasar,+id;d=2015-04-30;n=6;usd=1;si=dc7b320c;av=r"; $curl_connection = curl_init($url);  curl_setopt($curl_connection, curlopt_connecttimeout, 30); curl_setopt($curl_connection, curlopt_useragent, "mozilla/5.0 (windows nt 6.1) applewebkit/537.36 (khtml, gecko) chrome/42.0.2311.90 safari/537.36"); curl_setopt($curl_connection, curlopt_returntransfer, true); curl_setopt($curl_connection, curlopt_ssl_verifypeer, false); curl_setopt($curl_connection, curlopt_followlocation, 1);   $result = curl_exec($curl_connection); echo $result;    ?> 

i cannot hotel data google. wanted ask in scraping hotel data.

your case special. try scrape google's hotels directory.

  1. be aware google limiting requesting search pages (incl. paginaton) limit protect data web scraping. request frequency under control: proving if it's human or bot doing multiple requests.
  2. seems have parameters, please check how form them in query curl.
  3. since try query google's hotels (business) directory (https://www.google.com/hotels/#search), aware of scraping such directories, see some tips.

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -