chetan1029

Untitled

Jan 22nd, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.80 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. echo $html;
  89. require("IXR_Library.php");
  90. //////recplace domain.ro with your domain name ////////
  91. $client = new IXR_Client("http://www.putlockeris.org/xmlrpc.php");
  92. ///insert user and pass from wp-admin //
  93. $USER = 'kyle';
  94. $PASS = 'pass';
  95. ///end insert user and pass from wp-admin //
  96.  
  97. $ret = $html->find('div.mlink_imdb');
  98. foreach($ret as $elements) {
  99. foreach($elements->find('a') as $link) {
  100. $imdb = $link->href;
  101.  
  102. }
  103. }
  104.  
  105. $ret = $html->find('div.movie_thumb');
  106. foreach($ret as $img) {
  107. foreach($img->find('img') as $img_url) {
  108. $poster = $img_url->src;
  109.  
  110. }
  111. }
  112.  
  113. $theData = array();
  114. foreach($html->find('table tr') as $row) {
  115.  
  116. $rowData = array();
  117. foreach($row->find('td') as $cell) {
  118.  
  119. // push the cell's text to the array
  120. $rowData[] = $cell->plaintext;
  121. }
  122.  
  123. // push the row's data array to the 'big' array
  124. $theData[] = $rowData;
  125. }
  126.  
  127. foreach($theData[2] as $duration)
  128. foreach($theData[1] as $released)
  129. foreach($html->find('<td colspan="2"><p style="width:460px; display:block;">') as $description){
  130. $description = $description->plaintext;
  131. }
  132.  
  133. $meta_title = $html->find("meta[property='og:title']", 0)->content;
  134.  
  135. $imd=str_replace("http://www.imdb.com/title/","",$imdb);
  136. $pic=str_replace("//","http://",$poster);
  137.  
  138. $host = array();
  139. foreach($html->find('span.version_host') as $vhost) {
  140.  
  141. $host[] = $vhost->innertext;
  142. }
  143.  
  144.  
  145. $tilu = '';
  146. $strong = $html->find('h1.titles');
  147. foreach($strong as $el) {
  148. foreach($el->find('strong') as $strong_t) {
  149. $tilu .= $strong_t->plaintext;;
  150.  
  151. }
  152. }
  153. $genuri = array();
  154. foreach($html->find('span.movie_info_genres a') as $gen) {
  155. $genuri[] = $gen->plaintext;
  156. }
  157. $imdb = new Imdb();
  158. $movieArray = $imdb->getMovieInfo($imd);
  159. $chip = $movieArray['poster'];
  160. $release = $movieArray['release_date'];
  161. $runtime = $movieArray['runtime'];
  162. $rating = $movieArray['rating'];
  163. $year = $movieArray['year'];
  164. $country = implode(", ", $movieArray['country']);
  165. $stars = implode(", ", $movieArray['stars']);
  166. $director = implode(", ", $movieArray['directors']);
  167.  
  168. $link = array();
  169. foreach($html->find('div.choose_tabs div.actual_tab table.movie_version ') as $download){
  170. $link[] = $download->find('tr td span.movie_version_link a',0)->href;
  171.  
  172. }
  173. $url = '';
  174.  
  175. $moloz = '';
  176. $path = array();
  177. foreach($link as $lin){
  178. $parts = parse_url($lin);
  179. parse_str($parts['query'], $query);
  180. $urll = base64_decode($query['url']);
  181.  
  182. $url = parse_url($urll);
  183. $path[] = $url['path'];
  184. $host_lin = $url['host'];
  185. $host_link=str_replace("www.","",$host_lin);
  186. $path_link = $url['path'];
  187. $v1 = 'go.ad2up';
  188. $v2 = '.com/afu.php?id=223301';
  189. $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>';
  190.  
  191. }
  192. $content['title'] = $meta_title.$tilu;
  193. $content['description'] = $description;
  194.  
  195. $content['custom_fields'] = array(
  196. array('key' => 'poster','value'=>$pic),
  197. array('key' => 'run','value'=>''.$runtime.' min'),
  198. array('key' => 'released','value'=>$release),
  199. array('key' => 'actors','value'=>$stars),
  200. array('key' => 'directors','value'=>$director),
  201. array('key' => 'country','value'=>$country),
  202. array('key' => 'rating','value'=>$rating),
  203. array('key' => 'year','value'=>$year),
  204. array('key' => 'poza','value'=>$chip),
  205. array('key' => 'url','value'=>$moloz)
  206. );
  207.  
  208.  
  209.  
  210. if (!$client->query('metaWeblog.newPost','', $USER,$PASS, $content, true))
  211.  
  212. {
  213.  
  214. die( 'Error while creating a new post' . $client->getErrorCode() ." : ". $client->getErrorMessage());
  215.  
  216. }
  217. $ID = $client->getResponse();
  218.  
  219. if($ID)
  220. {
  221. echo 'Post published with ID:#'.$ID;
  222. }
  223.  
  224. ?>
Add Comment
Please, Sign In to add comment