i save this as php file in local and this works fine in browser
<form name="Form" method="post" action="http://www.idx.co.id/en-us/home/listedcompanies/issuedhistory.aspx" id="Form" enctype="multipart/form-data"><div><input type="hidden" name="StylesheetManager_TSSM" id="StylesheetManager_TSSM" value="" /><input type="hidden" name="ScriptManager_TSM" id="ScriptManager_TSM" value="" /><input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="dnn$ctr951$MainView$lbDownload" /><input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" /></div></form>
<script>
document.getElementById("Form").submit();
</script>
but how to do this in curl? i tried
function download($url, $path)
{
$fp = fopen ($path, 'w');
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, $url );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, false );
curl_setopt( $ch, CURLOPT_BINARYTRANSFER, true );
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 30 );
curl_setopt( $ch, CURLOPT_FILE, $fp );
$params = "StylesheetManager_TSSM=&ScriptManager_TSM=&__EVENTTARGET=dnn$ctr951$MainView$lbDownload&__EVENTARGUMENT=";
curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
curl_exec( $ch );
curl_close( $ch );
fclose( $fp );
if (filesize($path) > 0) return true;
}
$url = 'http://www.idx.co.id/en-us/home/listedcompanies/issuedhistory.aspx';
$path = 'corpactions.csv';
if (download($url, $path)){
echo 'Download complete!';
}
but it doesn't work as expected, it downloaded another page