Advertisement
Guest User

Untitled

a guest
May 29th, 2015
363
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. <?php
  2.  
  3. $imagesUrl = 'https://www.google.com.ua/search?q='.$query_pars.'&hl='.$lang.'&newwindow=1&safe=off&client=firefox-a&hs=bgB&rls=org.mozilla:ru:official&tbm=isch&gws_rd=cr&gbv=2';
  4.  
  5. // парсинг картинок
  6. function imagesGoogle($result){
  7.  
  8. $result = preg_replace("'\<noscript[^>]*?\>.*?\<\/noscript\>'si","",$result); // чтобы не перенаправило через meta
  9.  
  10. if(preg_match_all('#imgurl=(.*)&amp;.*src=\"(.*)\"#U',$result, $m)){
  11.  
  12. for ($i=0; $i<count($m[1]); $i++) {
  13. $m1[] = preg_replace("~\.jp(e)?g.*~", '.jp$1g', $m[1][$i]). ' * ' . $m[2][$i];
  14. }
  15.  
  16. $ThumbnailUrl = array_unique($m1);
  17.  
  18. } else {
  19. $ThumbnailUrl = '';
  20. }
  21.  
  22. // print_r($ThumbnailUrl);die;
  23. return $ThumbnailUrl;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement