Advertisement
Guest User

Untitled

a guest
Dec 8th, 2016
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.48 KB | None | 0 0
  1. $url="https://api.airbnb.com/v2/search_results?client_id=3092nxybyb0otqw18e8nh5nty&locale=es-ES&currency=EUR&_format=for_search_results&_limit=$limit&_offset=$offset&fetch_facets=true&guests=1&ib=false&ib_add_photo_flow=true&location=Las-Palmas-de-Gran-Canaria--Espa%25C3%25B1a&min_bathrooms=1&min_bedrooms=1&min_beds=1&min_num_pic_urls=0&price_max=1000&price_min=9&sort=1&user_lat=28.1132&user_lng=-15.4409";
  2.  
  3. $ci = curl_init();
  4. curl_setopt_array( $ci, array(CURLOPT_URL => $url,CURLOPT_TIMEOUT => 3600, CURLOPT_RETURNTRANSFER => true));
  5. $result = curl_exec($ci);
  6. curl_close($ci);
  7.  
  8. $data = json_decode($result, true);
  9. if(count($data['search_results']) == 0) die("No more listings");
  10.  
  11. foreach($data['search_results'] as $d) {
  12.  
  13. $id = $d['listing']['id'];
  14.  
  15. $urlita = "https://api.airbnb.com/v2/reviews?client_id=3092nxybyb0otqw18e8nh5nty&listing_id=$id&role=all";
  16.  
  17. $cii = curl_init();
  18. curl_setopt_array( $cii, array(CURLOPT_URL => $urlita,CURLOPT_TIMEOUT => 3600, CURLOPT_RETURNTRANSFER => true));
  19. $reviewResult = curl_exec($cii);
  20. curl_close($cii);
  21.  
  22. $review = json_decode($reviewResult, true);
  23.  
  24. foreach($review['reviews'] as $r){
  25. echo $r['author']['acceptance_rate'] . ";";
  26. echo $r['author']['created_at'] . ";";
  27. echo $r['author']['first_name'] . ";";
  28. echo $r['author']['has_profile_pic'] . ";";
  29. echo $r['author']['id'] . ";";
  30. echo $r['author']['identity_mt_verified'] . ";";
  31. echo $r['author']['identity_v2_verified'] . ";";
  32. echo $r['author']['identity_verified'] . ";";
  33. echo $r['author']['is_superhost'] . ";";
  34. echo $r['author']['is_trip_host'] . ";";
  35. echo $r['author']['picture_large_url'] . ";";
  36. echo $r['author']['picture_url'] . ";";
  37. echo $r['author']['recommendation_count'] . ";";
  38. echo $r['author']['response_rate'] . ";";
  39. echo $r['author']['response_time'] . ";";
  40. echo $r['author']['reviewee_count'] . ";";
  41. echo $r['author']['thumbnail_medium_url'] . ";";
  42. echo $r['author']['thumbnail_url'] . ";";
  43.  
  44. echo $r['author_id'] . ";";
  45. echo $r['can_be_edited'] . ";";
  46. echo $r['comments'] . ";";
  47. echo $r['created_at'] . ";";
  48. echo $r['id'] . ";";
  49. echo $r['listing_id'] . ";";
  50. echo $r['recipient_id'] . ";";
  51.  
  52. echo "n";
  53. }
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement