You are here: Re: [PHP] cURL functions « PHP « IT news, forums, messages
Re: [PHP] cURL functions

Posted by Jason Wong on 05/14/05 00:14

On Friday 13 May 2005 23:19, Chris Bruce wrote:
> I did look at your post on PATH_INFO which did not get me any closer to
> the solution. At this point, I am just trying to get an image using
> cURL and then force it to download to the computer. Here is the link:

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;


--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
New Year Resolution: Ignore top posted posts

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация