Advertisement
janter13

tes

Jun 25th, 2014
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.15 KB | None | 0 0
  1.  
  2. <?php
  3.  
  4.  
  5. function auto($url){
  6. $post = curl_init();
  7.     curl_setopt($post, CURLOPT_URL, $url);
  8.     curl_setopt($post,
  9.     CURLOPT_RETURNTRANSFER, 1);
  10.     curl_setopt($post,
  11.     CURLOPT_FOLLOWLOCATION, 1);
  12. $result = curl_exec($post);
  13.     curl_close($post);
  14. return $result;
  15. }
  16.  
  17. function xx($x){
  18.     echo '<pre>';
  19. print_r($x);
  20. echo '</pre>';
  21. }
  22.  
  23. function change_mal_info($a){
  24. if(preg_match('/English/', $a) && preg_match('/Synonyms/', $a)){
  25. $b = str_replace("\r\nSynonyms:", ', ', $a);
  26. $c = str_replace("English:", "Synonyms:", $b);
  27. }elseif(preg_match('/English/', $a) && !preg_match('/Synonyms/', $a)){
  28. $c = str_replace("English:", "Synonyms:", $a);
  29. }else{
  30. $c = $a;
  31. }
  32. return str_replace(array('Synonyms', 'Premiered', 'Genres'), array('Alternatif', 'Seasons', 'Genre'), $c);
  33. }
  34. function mal($uri){
  35. $source = auto($uri);
  36. preg_match('/js-scrollfix-bottom"(.*?)Statistics/s', $source, $nne);
  37. preg_match_all('/ratingValue">(.*?)</s', $source, $sco);
  38. $string= substr($nne[1], strpos($nne[1], '<h2>Alternative Titles</h2>'));;
  39. preg_match_all('/href="(.*?)">/s', $string, $matches);
  40. foreach($matches[1] as $link){
  41.     $ganti[] = '<a href="'.$link.'">';
  42. }
  43. $new = str_replace(array_merge(array('<span class="dark_text">','</span> ', '</div>', '</a>', '<br />', '<h2>', 'Information</h2>', 'Alternative Titles</h2>', '    ', '  ',"\r", "\n"), $ganti), '', $string);
  44. $news = str_replace('</span>', '',$new);
  45. $text = change_mal_info(str_replace(array('<div class="spaceit_pad">','<div class="spaceit">', '<div>'), "\r\n", $news));
  46. $mal_info['score'] = $sco[1][0];
  47. $mall = explode("\r\n", $text);
  48. foreach($mall as $anim){
  49. $exp = explode(':', $anim);
  50. $mal_info[strtolower($exp[0])] = $exp[1];
  51. }
  52.  
  53. $mal_info['alter'] = $mal_info['alternatif'].', '.$mal_info['japanese'];
  54. unset($mal_info['broadcast']);
  55. unset($mal_info['japanese']);
  56. unset($mal_info['rating']);
  57. unset($mal_info['source']);
  58. unset($mal_info['producers']);
  59. unset($mal_info['licensors']);
  60. unset($mal_info['type']);
  61. unset($mal_info['status']);
  62. unset( $mal_info['alternatif']);
  63. $mal_info = array_filter($mal_info);
  64. return $mal_info;
  65. }
  66. $mal = mal('https://myanimelist.net/anime/1/Cowboy_Bebop');
  67.  
  68.  
  69.  
  70. xx($mal);
  71.  
  72.  
  73.  
  74. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement