Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(0);
- function ngecurl($url , $post=null , $header=null){
- $ch = curl_init($url);
- if($post != null) {
- curl_setopt($ch, CURLOPT_POST, true);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
- }
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36");
- curl_setopt($ch, CURLOPT_COOKIEJAR, getcwd().'/'."cookies.txt");
- curl_setopt($ch, CURLOPT_COOKIEFILE, getcwd().'/'."cookies.txt");
- curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
- if($header != null) {
- curl_setopt($ch, CURLOPT_HTTPHEADER,$header);
- }
- curl_setopt($ch, CURLOPT_COOKIESESSION, true);
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT ,0);
- curl_setopt($ch, CURLOPT_TIMEOUT, 20);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
- unlink("cookies.txt");
- return curl_exec($ch);
- curl_close($ch);
- }
- function clean($string) {
- $string = str_replace(' ', '-', $string);
- return preg_replace('/[^A-Za-z0-9\-]/', '', $string);
- }
- $re = '/\'Category (.*?)\'\);" alt="(.*?)"/';
- $str = ngecurl("http://www.pornhub.com/video?c=111");
- preg_match_all($re, $str , $matches);
- echo "------[ Category ]-------\r\n";
- foreach ($matches[1] as $key => $value) {
- $idcata[] = $value;
- $cataname[] = $matches[2][$key];
- }
- if($idcata != null){
- foreach ($idcata as $key => $idcatas) {
- $catanams = $cataname[$key];
- for ($i=0; $i <150; $i++) {
- preg_match_all('/<a href="(.*?)" title="(.*?)">(.*?)<\/a>/', ngecurl("http://www.pornhub.com/video?c=".$idcatas."&page=".$i) , $matches);
- foreach ($matches[0] as $key => $value) {
- $re = '/\/view_video\.php\?viewkey=/';
- preg_match_all($re, $value, $matches);
- if($matches[0][0]){
- $re = '/<a href="(.*?)" title="(.*?)">/';
- preg_match_all($re, $value, $matches);
- $link = "http://www.pornhub.com".$matches[1][0];
- $links[] = $link."\r\n";
- $item = array(
- 'link' => $link,
- 'title1' => $matches[2][0] ,
- 'title2' => clean($matches[2][0])
- );
- $data[] = $item;
- }
- }
- echo "Page : ".$i." | Cata : ".$catanams." Total : ".count($links)."\r\n";
- }
- }
- echo "Total : ".count(array_unique($links))."\r\n";
- if( file_put_contents("asu.json", json_encode(array('pornhub' => $data)))){
- echo "SUDAH DI SAVE\r\n";
- }else{
- print_r(json_encode(array('pornhub' => $data)));
- }
- if( file_put_contents("link.json", json_encode(array('pornhub' => array($links))))){
- echo "SUDAH DI SAVE\r\n";
- }else{
- print_r(json_encode(array('pornhub' => $data)));
- }
- }else{
- echo "ID NULL COK\r\n";
- exit();
- }
Add Comment
Please, Sign In to add comment