SHARE
TWEET

CURL StackOverflow question

a guest Feb 20th, 2012 128 Never
  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. ?>
RAW Paste Data
Top