There is a site https://salmonprice.nasdaqomxtrader.com/public/report;jsessionid=110C4ADED76BEEE6E08401DFF1539728?0 from where we need to download an excel file on a periodical basis. The file link is below:
When we click the above link the excel file started to download.
I am trying in the following way to save the file in PHP:
$url = https://salmonprice.nasdaqomxtrader.com/public/report;jsessionid=AC40D42FFE3C6F71B7C0D74F7545AC87?0-3.ILinkListener-loginMenu-downloadIndexHistoryLink';
$file_name = "test.xls";
if(file_put_contents( $file_name,file_get_contents($url))) {
echo "File downloaded successfully";
}
else {
echo "File downloading failed.";
}
but this attempt downloading web page content not excel file content. How can I solve this problem?