php-general | 2005051
Date: 05/13/05
- Next message: Sam Smith: "[PHP] phpMyAdmin authentication error"
- Previous message: dan: "Re: [PHP] Form handling"
- In reply to: Jason Wong: "Re: [PHP] cURL functions"
- Next in thread: Jason Wong: "Re: [PHP] cURL functions"
- Reply: Jason Wong: "Re: [PHP] cURL functions"
- Reply: Richard Lynch: "Re: [PHP] cURL functions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> This should work:
>
> $ch = curl_init(); // create cURL handle (ch)
> if (!$ch) {
> die("Couldn't initialize a cURL handle");
> }
> // set some cURL options
> $ret = curl_setopt($ch, CURLOPT_URL,
> "http://images.apple.com/home/2005/images/
> tigershippingdashboard20050429.jpg");
> $ret = curl_setopt($ch, CURLOPT_HEADER, 0);
> $ret = curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
> $ret = curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
> $ret = curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
> $ret = curl_setopt($ch, CURLOPT_TIMEOUT, 30);
>
> // execute
> $ret = curl_exec($ch);
> header("Content-type: image/jpg");
> Header('Content-Disposition: attachment;
> file="tigershippingdashboard20050429.jpg"');
> echo $ret;
Did you try this Jason? When I try it, it just downloads the
getimage.php file with the binary content of the image in the file.
Chris
- Next message: Sam Smith: "[PHP] phpMyAdmin authentication error"
- Previous message: dan: "Re: [PHP] Form handling"
- In reply to: Jason Wong: "Re: [PHP] cURL functions"
- Next in thread: Jason Wong: "Re: [PHP] cURL functions"
- Reply: Jason Wong: "Re: [PHP] cURL functions"
- Reply: Richard Lynch: "Re: [PHP] cURL functions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

