Advertisement
Guest User

Untitled

a guest
Oct 12th, 2016
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.52 KB | None | 0 0
  1. function searchImage($iata) {
  2.     $ch = curl_init();
  3.     curl_setopt($ch, CURLOPT_URL, "https://www.flickr.com/search/?sort=interestingness-desc&advanced=1&dimension_search_mode=min&height=1024&width=1024&orientation=landscape&media=photos&text=" . $iata . " city");
  4.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
  5.     curl_setopt($ch, CURLOPT_HEADER, FALSE);
  6.     $response = curl_exec($ch);
  7.     curl_close($ch);
  8.     preg_match("/view photo-list-photo-view [.*?] url\((.*?)\)/", $response, $q);
  9.     $url_photo = $q[1];
  10.     echo $url_photo;
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement