Can't figure out what is wrong in this simple PHP cURL request. Request works fine in Postman. It is a POST request that returns html data.
$params = array(
"County_ID" => "62",
"Location_ID" => "73",
"Court" => "Both",
"DocketMonth" => "3",
"DocketDay" => "30",
"DocketYear" => "2015",
"Lastname" => "",
"Firstname" => "John"
);
$url = "https://www.courts.state.co.us/dockets/index.cfm#results";
$postData = '';
foreach ($params as $k => $v) {
$postData .= $k . '=' . $v . '&';
}
rtrim($postData, '&');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_POST, count($postData));
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
$output = curl_exec($ch);
curl_close($ch);
echo $output;