Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

CURL StackOverflow question

By: a guest on Feb 20th, 2012  |  syntax: PHP  |  size: 0.52 KB  |  views: 107  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2. $URL = "https://storage-ec2-32.sharefile.com/download.ashx?dt=dtca3192857a45452c84bd14e7500c7f46";
  3. $fp = fopen("test.txt", 'w');
  4. $c = curl_init($URL);
  5. if (curl_setopt($c, CURLOPT_FILE, $fp) == FALSE) {
  6.         die(curl_error($c));
  7. }
  8. if (curl_setopt($c, CURLOPT_FOLLOWLOCATION, 1) == FALSE) {
  9.         die(curl_error($c));
  10. }
  11. if (curl_setopt($c, CURLOPT_SSL_VERIFYPEER, FALSE) == FALSE) {
  12.         die(curl_error($c));
  13. }
  14. if (curl_exec($c) == FALSE) {
  15.         die(curl_error($c));
  16. }
  17. $info = curl_getinfo($c);
  18. curl_close($c);
  19. fclose($fp);
  20. ?>