Guest User

PHP Side by Riccor

a guest
Sep 6th, 2012
1,569
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. <?php
  2. if(!function_exists('curl_init')) die("Curl PHP package is not installed!");
  3.  
  4. $linkid = $_GET['linkid'];
  5. $limit = $_GET['limit'];
  6. $curl = curl_init();
  7.  
  8. $expire = 3;
  9. curl_setopt($curl, CURLOPT_URL, $linkid);
  10. curl_setopt($curl, CURLOPT_HEADER, false);
  11. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  12. curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 3);
  13. $content = curl_exec($curl);
  14. curl_close($curl);
  15.  
  16. $offset = 0;
  17. $counter = 0;
  18. $result = strpos($content, "\"href=\"/watch?v=", $offset);
  19. while($result != false)
  20. {
  21. echo ">";
  22. $assist = substr($content, $result + 16, 11);
  23. echo $assist;
  24. $var = strpos($content, "</a>", $result + 29);
  25. echo " = ";
  26. $assist = substr($content, $result + 29, $var - 29 - $result);
  27. echo $assist;
  28. echo "<";
  29. $counter++;
  30. $offset = $result + 164;
  31. $result = strpos($content, "\"href=\"/watch?v=", $offset);
  32. if($counter >= $limit) break;
  33. }
  34. if($counter == 0) echo "No results found!";
  35. ?>
Advertisement
Add Comment
Please, Sign In to add comment