Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include('simple_html_dom.php');
- include("imdb.php");
- $html = new simple_html_dom();
- //$html->load_file($_GET['q']);
- function get_final_url( $url, $timeout = 5 )
- {
- $url = str_replace( "&", "&", urldecode(trim($url)) );
- $cookie = tempnam ("/tmp", "CURLCOOKIE");
- $ch = curl_init();
- curl_setopt( $ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20041001 Firefox/0.10.1" );
- curl_setopt( $ch, CURLOPT_URL, $url );
- curl_setopt( $ch, CURLOPT_COOKIEJAR, $cookie );
- curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
- curl_setopt( $ch, CURLOPT_ENCODING, "" );
- curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
- curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
- curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout );
- curl_setopt( $ch, CURLOPT_TIMEOUT, $timeout );
- curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
- $content = curl_exec( $ch );
- $response = curl_getinfo( $ch );
- curl_close ( $ch );
- if ($response['http_code'] == 301 || $response['http_code'] == 302)
- {
- ini_set("user_agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20041001 Firefox/0.10.1");
- $headers = get_headers($response['url']);
- $location = "";
- foreach( $headers as $value )
- {
- if ( substr( strtolower($value), 0, 9 ) == "location:" )
- return get_final_url( trim( substr( $value, 9, strlen($value) ) ) );
- }
- }
- if ( preg_match("/window\.location\.replace\('(.*)'\)/i", $content, $value) ||
- preg_match("/window\.location\=\"(.*)\"/i", $content, $value)
- )
- {
- return get_final_url ( $value[1] );
- }
- else
- {
- return $response['url'];
- }
- }
- function getPage($url) {
- $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';
- $timeout= 120;
- $dir = dirname(__FILE__);
- $cookie_file = $dir . '/cookies/' . md5($_SERVER['REMOTE_ADDR']) . '.txt';
- $ch = curl_init($url);
- curl_setopt($ch, CURLOPT_FAILONERROR, true);
- curl_setopt($ch, CURLOPT_HEADER, 0);
- curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
- curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true );
- curl_setopt($ch, CURLOPT_ENCODING, "" );
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true );
- curl_setopt($ch, CURLOPT_AUTOREFERER, true );
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout );
- curl_setopt($ch, CURLOPT_TIMEOUT, $timeout );
- curl_setopt($ch, CURLOPT_MAXREDIRS, 10 );
- curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
- curl_setopt($ch, CURLOPT_REFERER, 'http://www.google.com/');
- $content = curl_exec($ch);
- if(curl_errno($ch))
- {
- echo 'error:' . curl_error($ch);
- }
- else
- {
- return $content;
- }
- curl_close($ch);
- }
- $s_url = get_final_url($_GET['q']);
- //$html = getPage($s_url);
- $html->load_file($s_url);
- echo $html;
- require("IXR_Library.php");
- //////recplace domain.ro with your domain name ////////
- $client = new IXR_Client("http://www.putlockeris.org/xmlrpc.php");
- ///insert user and pass from wp-admin //
- $USER = 'kyle';
- $PASS = 'pass';
- ///end insert user and pass from wp-admin //
- $ret = $html->find('div.mlink_imdb');
- foreach($ret as $elements) {
- foreach($elements->find('a') as $link) {
- $imdb = $link->href;
- }
- }
- $ret = $html->find('div.movie_thumb');
- foreach($ret as $img) {
- foreach($img->find('img') as $img_url) {
- $poster = $img_url->src;
- }
- }
- $theData = array();
- foreach($html->find('table tr') as $row) {
- $rowData = array();
- foreach($row->find('td') as $cell) {
- // push the cell's text to the array
- $rowData[] = $cell->plaintext;
- }
- // push the row's data array to the 'big' array
- $theData[] = $rowData;
- }
- foreach($theData[2] as $duration)
- foreach($theData[1] as $released)
- foreach($html->find('<td colspan="2"><p style="width:460px; display:block;">') as $description){
- $description = $description->plaintext;
- }
- $meta_title = $html->find("meta[property='og:title']", 0)->content;
- $imd=str_replace("http://www.imdb.com/title/","",$imdb);
- $pic=str_replace("//","http://",$poster);
- $host = array();
- foreach($html->find('span.version_host') as $vhost) {
- $host[] = $vhost->innertext;
- }
- $tilu = '';
- $strong = $html->find('h1.titles');
- foreach($strong as $el) {
- foreach($el->find('strong') as $strong_t) {
- $tilu .= $strong_t->plaintext;;
- }
- }
- $genuri = array();
- foreach($html->find('span.movie_info_genres a') as $gen) {
- $genuri[] = $gen->plaintext;
- }
- $imdb = new Imdb();
- $movieArray = $imdb->getMovieInfo($imd);
- $chip = $movieArray['poster'];
- $release = $movieArray['release_date'];
- $runtime = $movieArray['runtime'];
- $rating = $movieArray['rating'];
- $year = $movieArray['year'];
- $country = implode(", ", $movieArray['country']);
- $stars = implode(", ", $movieArray['stars']);
- $director = implode(", ", $movieArray['directors']);
- $link = array();
- foreach($html->find('div.choose_tabs div.actual_tab table.movie_version ') as $download){
- $link[] = $download->find('tr td span.movie_version_link a',0)->href;
- }
- $url = '';
- $moloz = '';
- $path = array();
- foreach($link as $lin){
- $parts = parse_url($lin);
- parse_str($parts['query'], $query);
- $urll = base64_decode($query['url']);
- $url = parse_url($urll);
- $path[] = $url['path'];
- $host_lin = $url['host'];
- $host_link=str_replace("www.","",$host_lin);
- $path_link = $url['path'];
- $v1 = 'go.ad2up';
- $v2 = '.com/afu.php?id=223301';
- $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>';
- }
- $content['title'] = $meta_title.$tilu;
- $content['description'] = $description;
- $content['custom_fields'] = array(
- array('key' => 'poster','value'=>$pic),
- array('key' => 'run','value'=>''.$runtime.' min'),
- array('key' => 'released','value'=>$release),
- array('key' => 'actors','value'=>$stars),
- array('key' => 'directors','value'=>$director),
- array('key' => 'country','value'=>$country),
- array('key' => 'rating','value'=>$rating),
- array('key' => 'year','value'=>$year),
- array('key' => 'poza','value'=>$chip),
- array('key' => 'url','value'=>$moloz)
- );
- if (!$client->query('metaWeblog.newPost','', $USER,$PASS, $content, true))
- {
- die( 'Error while creating a new post' . $client->getErrorCode() ." : ". $client->getErrorMessage());
- }
- $ID = $client->getResponse();
- if($ID)
- {
- echo 'Post published with ID:#'.$ID;
- }
- ?>
Add Comment
Please, Sign In to add comment