Download xls file with CasperJS/PhantomJS

时间:2015-05-08 09:55:50

标签: javascript excel phantomjs casperjs

I want to scrape a website that is containing an excel file that I want to download. The download part works, but when I open the file I see a forbidden message that is saying that downloading of the file is not allowed.

plot \
"ikpapache.dat" using :1 title "ap rr", \
"ikphaproxy.dat" using :1 title "ha rr"

Do I need to add some headers to get it working? Or what could be the problem?

1 个答案:

答案 0 :(得分:0)

Sorry guys I made a mistake. I've put verbose in the wrong place and didn't see any errors. It is working now with this code:

<?php
include('simple_html_dom.php');


$sContent = file_get_contents('http://iztv.com.tr/program.aspx?id='.$_GET['id']);

$DOM = str_get_html($sContent);

$description = $DOM -> find('#ctl00_ContentPlaceHolder1_aciklama',0)->innertext;

//print_r($m);

$arr['aciklama'] = addslashes($description);

$json->result->program_detayi[] = $arr;
echo json_encode($json, true);

?>