Advertisement
viprajput

graber.php

Jun 13th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. <?php
  2. /* gets the data from a URL */
  3. function get_data($url) {
  4. $ch = curl_init();
  5. $timeout = 5;
  6. curl_setopt($ch, CURLOPT_URL, $url);
  7. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  8. curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
  9. $data = curl_exec($ch);
  10. curl_close($ch);
  11. return $data;
  12. }
  13. if (!empty($_GET['grabURL'])){
  14. echo get_data($_GET['grabURL']);
  15. } else {
  16. echo ('ERROR: grabURL parameter was not specified');
  17. }
  18. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement