when i hit the following url with the postman app its working fine
http://192.168.1.220/cgi-bin/handle_login.tcl
but when tried with curl its giving me following error
The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.
Below is my php code
<?php
$postData = array(
'user' => 'admin',
'pw' => 'admin',
'submit' => 'Login'
);
// Setup cURL
$ch = curl_init('http://192.168.1.220/cgi-bin/handle_login.tcl');
curl_setopt_array($ch, array(
CURLOPT_POST => TRUE,
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_HTTPHEADER => array('Content-Type: application/x-www-form-urlencoded'
),
CURLOPT_POSTFIELDS => json_encode($postData)
));
// Send the request
$response = curl_exec($ch);
var_dump($response);
// Check for errors
if($response === FALSE){
die(curl_error($ch));
}
// Decode the response
$responseData = json_decode($response, TRUE);
// Print the date from the response
echo $responseData['published'];
?>