How to use Simple HTML DOM with input POST method?
I try to do with cUrl:
$ch = curl_init();
$timeout=5;
$data = array('teks' => '4ia17');
$data=http_build_query($data);
curl_setopt($ch,CURLOPT_URL,"http://baak.gunadarma.ac.id/jadwal/cariJadKul");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
$datas = curl_exec($ch);
curl_close($ch);
echo $datas;
the problem is : problem and i try to do this too
include("simple_html_dom.php");
$request = array(
'http' => array(
'header' => array("Content-Type: application/x-www-form-urlencoded"),
'method' => 'POST',
'content' => http_build_query(array(
'teks' => '4ia17'
)),
)
);
$context = stream_context_create($request);
$htmls = file_get_html("http://baak.gunadarma.ac.id/jadwal/cariJadKul",true, $context);
echo $htmls;
and the error is :
Warning: file_get_contents(http://baak.gunadarma.ac.id/jadwal/cariJadKul): failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error in C:\xampp\htdocs\php-youtube-dl-master\Downloader\simple_html_dom.php on line 75
can anyone please help me where lies the error is? or something i can do with?