Advertisement
joris

CURL

Aug 10th, 2012
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.00 KB | None | 0 0
  1. <?php
  2. $url="http://m.21cineplex.com/";
  3. function bacaHTML($url){
  4.     // inisialisasi CURL
  5.     $data = curl_init();
  6.     // setting CURL
  7.     curl_setopt($data, CURLOPT_URL, $url);
  8.     curl_setopt($data, CURLOPT_HEADER, 1);
  9.     curl_setopt($data, CURLOPT_USERAGENT, "Mozilla/5.0 (BlackBerry; U; BlackBerry 9850; en-US) AppleWebKit/534.11+ (KHTML, like Gecko) Version/7.0.0.115 Mobile Safari/534.11+");
  10.     curl_setopt($data,CURLOPT_COOKIEJAR,'cookie.txt');
  11.     curl_setopt($data,CURLOPT_COOKIEFILE,'cookie.txt');
  12.     curl_setopt($data, CURLOPT_FOLLOWLOCATION, 1);
  13.     curl_setopt($data, CURLOPT_RETURNTRANSFER, 1);
  14.     $hasil = curl_exec($data);
  15.     curl_close($data);
  16.     return $hasil;
  17. }
  18.  
  19. $html= bacaHTML($url);
  20.  
  21. $html=str_replace(array("\r","\t","\n"),"",$html);
  22. preg_match_all("/<ol id=\"menu_ol\">(.*?)<\/ol>/",$html,$raw);
  23.  
  24. $raw[0]= str_replace("href=\"","href=\"$url",$raw[0]);
  25. echo "<p>Now Playing</p>".$raw[0][0]."<p>Coming Soon".$raw[0][1]."Movie News".$raw[0][2]."Slow Motion".$raw[0][3];
  26. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement