<?php $videos_page = 'http://www.website.com'; function getVideos($videos_page) { $str = file_get_contents($videos_page); preg_match_all('/<li class="videoblock(.*?)<\/li>/si', $str, $matches); if ( isset($matches['0']) ) { $video = str_replace('website.com', 'mywebsite.com', $matches['0']); $video = str_replace('', '', $video); return $video; } } echo getVideos($videos_page); ?> Code (markup): if i add this code is show me on the page "Array" how i can make to show me all that videos from that page ? i dont know what is my command mistake thanks for the help
i have one command what i succes to take just the movies from index page but i dont know how to remove the " preg_match('/>(.*?)<\/a>/ms', $link, $matches_tag); " i try so many ways but all time is give me error <?php $serverlink = 'http://www.pornhub.com'; function getDomainsWithTraficSimilar($serverlink) { $str = file_get_contents($serverlink); preg_match_all('/<li class="videoblock(.*?)<\/li>/si', $str, $matches); if ( isset($matches['0']) ) { $tag_links = $matches['0']; $tags = array(); foreach ( $tag_links as $link ) { preg_match('/>(.*?)<\/a>/ms', $link, $matches_tag); if ( isset($matches_tag['0']) ) { $tag = str_replace('', '', $matches_tag['0']); $tag = str_replace('', '', $tag); $tags[] = $tag; } } return implode(' ', $tags); } } echo getDomainsWithTraficSimilar($serverlink); ?> Code (markup):
<?php $videos_page = 'http://www.website.com/'; $videos = get_data($videos_page); $video = get_match('/<li class="videoblock videos_[0-9]">(.*)<\/li>/is',$videos); echo "$video"; function get_match($regex,$content) { preg_match($regex,$content,$matches); return $matches[1]; } function get_data($url) { $ch = curl_init(); $timeout = 5; curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout); $data = curl_exec($ch); curl_close($ch); return $data; } ?> PHP: Now what else did you want removed or edited ?
hello there, thanks for the help, i try your script on my website www.onjizz.com/pornhub and i change little your command <?php $videos_page = 'http://www.pornhub.com/'; $videos = get_data($videos_page); $video = get_match('/<div class="wrap">(.*)<\/div>/is',$videos); echo "$video"; function get_match($regex,$content) { preg_match($regex,$content,$matches); return $matches[1]; } function get_data($url) { $ch = curl_init(); $timeout = 5; curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout); $data = curl_exec($ch); curl_close($ch); return $data; } ?> Code (markup): and how i see is take from pornhub.com more than i want, what i really want is example pornhub source code <div class="wrap"> <a href="http://www.pornhub.com/view_video.php?viewkey=1c76d9cea643cdcf34fe" class="img" title="Asian slut gets an extreme ass and throat fucking before getting spermed on"> <img src="http://ph-pics.phncdn.com/thumbs/000/094/707/small.jpg?cache=0" alt="Asian slut gets an extreme ass and throat fucking before getting spermed on" class="rotating" id="94707" onmouseover="startThumbChange('94707', 16, 'http://ph-pics.phncdn.com/thumbs/000/094/707/');" onmouseout="endThumbChange('94707', 'http://ph-pics.phncdn.com/thumbs/000/094/707/');" /> </a> <h5 class="title"><a href="http://www.pornhub.com/view_video.php?viewkey=1c76d9cea643cdcf34fe" class="title" title="Asian slut gets an extreme ass and throat fucking before getting spermed on">Asian slut gets an extreme ass and throat fucking before getting spermed on</a></h5> <span class="rating"> <var style="width: 90.32%;">4.51603</var> </span> <var class="duration">7:00</var> <span class="views"><var>372641</var> views</span> <var class="added">2 years ago </var> </div> Code (markup): so to take just the videos from the home page, thanks for the help again
Maybe someone could help you with limiting the results to 10 matches etc... I'm unsure myself sorry <?php $videos_page = 'http://www.pornhub.com/'; $videos = get_data($videos_page); $video = get_match('/<li class="videoblock videos_[0-9]">(.*)<\/li>/s',$videos); echo "$video"; function get_match($regex,$content) { preg_match($regex,$content,$matches); return $matches[1]; } function get_data($url) { $ch = curl_init(); $timeout = 5; curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout); $data = curl_exec($ch); curl_close($ch); return $data; } ?> PHP: