chetan1029

Untitled

Jan 22nd, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.83 KB | None | 0 0
  1. <?php
  2.  
  3. include('simple_html_dom.php');
  4. include("imdb.php");
  5.  
  6.  
  7.  
  8. $html = new simple_html_dom();
  9. //$html->load_file($_GET['q']);
  10. function get_final_url( $url, $timeout = 5 )
  11. {
  12. $url = str_replace( "&amp;", "&", urldecode(trim($url)) );
  13.  
  14. $cookie = tempnam ("/tmp", "CURLCOOKIE");
  15. $ch = curl_init();
  16. curl_setopt( $ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20041001 Firefox/0.10.1" );
  17. curl_setopt( $ch, CURLOPT_URL, $url );
  18. curl_setopt( $ch, CURLOPT_COOKIEJAR, $cookie );
  19. curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
  20. curl_setopt( $ch, CURLOPT_ENCODING, "" );
  21. curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
  22. curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
  23. curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout );
  24. curl_setopt( $ch, CURLOPT_TIMEOUT, $timeout );
  25. curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
  26. $content = curl_exec( $ch );
  27. $response = curl_getinfo( $ch );
  28. curl_close ( $ch );
  29.  
  30. if ($response['http_code'] == 301 || $response['http_code'] == 302)
  31. {
  32. ini_set("user_agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20041001 Firefox/0.10.1");
  33. $headers = get_headers($response['url']);
  34.  
  35. $location = "";
  36. foreach( $headers as $value )
  37. {
  38. if ( substr( strtolower($value), 0, 9 ) == "location:" )
  39. return get_final_url( trim( substr( $value, 9, strlen($value) ) ) );
  40. }
  41. }
  42.  
  43. if ( preg_match("/window\.location\.replace\('(.*)'\)/i", $content, $value) ||
  44. preg_match("/window\.location\=\"(.*)\"/i", $content, $value)
  45. )
  46. {
  47. return get_final_url ( $value[1] );
  48. }
  49. else
  50. {
  51. return $response['url'];
  52. }
  53. }
  54. function getPage($url) {
  55. $useragent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.89 Safari/537.36';
  56. $timeout= 120;
  57. $dir = dirname(__FILE__);
  58. $cookie_file = $dir . '/cookies/' . md5($_SERVER['REMOTE_ADDR']) . '.txt';
  59.  
  60. $ch = curl_init($url);
  61. curl_setopt($ch, CURLOPT_FAILONERROR, true);
  62. curl_setopt($ch, CURLOPT_HEADER, 0);
  63. curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
  64. curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
  65. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true );
  66. curl_setopt($ch, CURLOPT_ENCODING, "" );
  67. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true );
  68. curl_setopt($ch, CURLOPT_AUTOREFERER, true );
  69. curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout );
  70. curl_setopt($ch, CURLOPT_TIMEOUT, $timeout );
  71. curl_setopt($ch, CURLOPT_MAXREDIRS, 10 );
  72. curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
  73. curl_setopt($ch, CURLOPT_REFERER, 'http://www.google.com/');
  74. $content = curl_exec($ch);
  75. if(curl_errno($ch))
  76. {
  77. echo 'error:' . curl_error($ch);
  78. }
  79. else
  80. {
  81. return $content;
  82. }
  83. curl_close($ch);
  84.  
  85. }
  86. $s_url = get_final_url($_GET['q']);
  87. //$html = getPage($s_url);
  88. $html->load_file($s_url);
  89. echo $html;
  90. require("IXR_Library.php");
  91. //////recplace domain.ro with your domain name ////////
  92. $client = new IXR_Client("http://www.putlockeris.org/xmlrpc.php");
  93. ///insert user and pass from wp-admin //
  94. $USER = 'kyle';
  95. $PASS = 'pass';
  96. ///end insert user and pass from wp-admin //
  97.  
  98. $ret = $html->find('div.mlink_imdb');
  99. foreach($ret as $elements) {
  100. foreach($elements->find('a') as $link) {
  101. $imdb = $link->href;
  102.  
  103. }
  104. }
  105.  
  106. $ret = $html->find('div.movie_thumb');
  107. foreach($ret as $img) {
  108. foreach($img->find('img') as $img_url) {
  109. $poster = $img_url->src;
  110.  
  111. }
  112. }
  113.  
  114. $theData = array();
  115. foreach($html->find('table tr') as $row) {
  116.  
  117. $rowData = array();
  118. foreach($row->find('td') as $cell) {
  119.  
  120. // push the cell's text to the array
  121. $rowData[] = $cell->plaintext;
  122. }
  123.  
  124. // push the row's data array to the 'big' array
  125. $theData[] = $rowData;
  126. }
  127.  
  128. foreach($theData[2] as $duration)
  129. foreach($theData[1] as $released)
  130. foreach($html->find('<td colspan="2"><p style="width:460px; display:block;">') as $description){
  131. $description = $description->plaintext;
  132. }
  133.  
  134. $meta_title = $html->find("meta[property='og:title']", 0)->content;
  135.  
  136. $imd=str_replace("http://www.imdb.com/title/","",$imdb);
  137. $pic=str_replace("//","http://",$poster);
  138.  
  139. $host = array();
  140. foreach($html->find('span.version_host') as $vhost) {
  141.  
  142. $host[] = $vhost->innertext;
  143. }
  144.  
  145.  
  146. $tilu = '';
  147. $strong = $html->find('h1.titles');
  148. foreach($strong as $el) {
  149. foreach($el->find('strong') as $strong_t) {
  150. $tilu .= $strong_t->plaintext;;
  151.  
  152. }
  153. }
  154. $genuri = array();
  155. foreach($html->find('span.movie_info_genres a') as $gen) {
  156. $genuri[] = $gen->plaintext;
  157. }
  158. $imdb = new Imdb();
  159. $movieArray = $imdb->getMovieInfo($imd);
  160. $chip = $movieArray['poster'];
  161. $release = $movieArray['release_date'];
  162. $runtime = $movieArray['runtime'];
  163. $rating = $movieArray['rating'];
  164. $year = $movieArray['year'];
  165. $country = implode(", ", $movieArray['country']);
  166. $stars = implode(", ", $movieArray['stars']);
  167. $director = implode(", ", $movieArray['directors']);
  168.  
  169. $link = array();
  170. foreach($html->find('div.choose_tabs div.actual_tab table.movie_version ') as $download){
  171. $link[] = $download->find('tr td span.movie_version_link a',0)->href;
  172.  
  173. }
  174. $url = '';
  175.  
  176. $moloz = '';
  177. $path = array();
  178. foreach($link as $lin){
  179. $parts = parse_url($lin);
  180. parse_str($parts['query'], $query);
  181. $urll = base64_decode($query['url']);
  182.  
  183. $url = parse_url($urll);
  184. $path[] = $url['path'];
  185. $host_lin = $url['host'];
  186. $host_link=str_replace("www.","",$host_lin);
  187. $path_link = $url['path'];
  188. $v1 = 'go.ad2up';
  189. $v2 = '.com/afu.php?id=223301';
  190. $moloz .= '<table width="100%" cellpadding="0" cellspacing="0" class="movie_version movie_version_alt"><tbody><tr><td align="center" width="40" valign="middle"><span class=quality_dvd></span></td><td align="left" valign="middle"><span class="movie_version_link"><a href="http://'.(isset($host_link) && !empty($host_link) ? $host_link : $v1).''.(isset($path_link) && !empty($path_link) ? $path_link : $v2).'" rel="nofollow" title="Version '.count($path).'" target="_blank">Version '.count($path).' - Direct Link</a></span></td><td align="center" width="115" valign="middle"><span class="version_host">'.(isset($host_link) && !empty($host_link) ? $host_link : $v1).'</span></td><td align="center" width="100" valign="middle"><div class="movie_ratings"><ul id="unit_ul1894478038" class="unit-rating" style="width:100px;"> <a href="http://'.(isset($host_link) && !empty($host_link) ? $host_link : $v1).''.(isset($path_link) && !empty($path_link) ? $path_link : $v2).'" rel="nofollow" title="Version '.count($path).'" target="_blank"><img src="/play_video.gif" alt="stele" ></a> </ul></div></td></tr></tbody></table>';
  191.  
  192. }
  193. $content['title'] = $meta_title.$tilu;
  194. $content['description'] = $description;
  195.  
  196. $content['custom_fields'] = array(
  197. array('key' => 'poster','value'=>$pic),
  198. array('key' => 'run','value'=>''.$runtime.' min'),
  199. array('key' => 'released','value'=>$release),
  200. array('key' => 'actors','value'=>$stars),
  201. array('key' => 'directors','value'=>$director),
  202. array('key' => 'country','value'=>$country),
  203. array('key' => 'rating','value'=>$rating),
  204. array('key' => 'year','value'=>$year),
  205. array('key' => 'poza','value'=>$chip),
  206. array('key' => 'url','value'=>$moloz)
  207. );
  208.  
  209.  
  210.  
  211. if (!$client->query('metaWeblog.newPost','', $USER,$PASS, $content, true))
  212.  
  213. {
  214.  
  215. die( 'Error while creating a new post' . $client->getErrorCode() ." : ". $client->getErrorMessage());
  216.  
  217. }
  218. $ID = $client->getResponse();
  219.  
  220. if($ID)
  221. {
  222. echo 'Post published with ID:#'.$ID;
  223. }
  224.  
  225. ?>
Add Comment
Please, Sign In to add comment