Get file from website with PHP

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
vhiguita
Forum Newbie
Posts: 4
Joined: Mon Apr 09, 2012 12:06 am

Get file from website with PHP

Post by vhiguita »

Hi,

I need to know how could I download (kayak-fra-lax-20120423.csv) a file from the website http://www.kayak.com/#/flights/FRA-LAX/2012-04-23 using php. I am doing it with the next code.

<?php


header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"kayak-fra-lax-20120423.csv\"");
//$data="col1, col start and end col2,col3, \n";
//$data .= "seond linedata here from site to download col1";
//echo $data;

?>
But it shows me a new one.

Thanks in advance.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Get file from website with PHP

Post by Celauran »

Have you looked at cURL?
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Get file from website with PHP

Post by requinix »

You can copy it to your server as long as you have the actual path to the CSV file (which that URL you posted is not).
Post Reply