Login from another website (remote login) using cURL

I am using the below code to login to the system using cURL. But obviously our browser uses a different cookie file and my cURL is using a different cookie file. So when I am trying to access my website’s desk from the browser it naturally block me. So, can you tell me how to remote login to the desk?

<?php define("COOKIE_FILE", "cookie.txt"); // =============login================= $ch = curl_init('http://XX.XX.XX.XX/api/method/login'); curl_setopt( $ch, CURLOPT_POSTFIELDS,array( 'usr'=>'Administrator', 'pwd'=>'XXXXXXXXX')); curl_setopt ($ch, CURLOPT_COOKIEJAR, COOKIE_FILE); curl_setopt ($ch, CURLOPT_COOKIEFILE, COOKIE_FILE); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); //curl_setopt($ch, CURLOPT_HEADER, true); $result = curl_exec($ch); header("location: http://XX.XX.XX.XX/desk"); ?>

If that seems something impossible, then any idea how to prefill the email and password fields in the login page?

Here is a frappe client for PHP