curl can’t fill password input with autocomplete=off tag

I’m trying to login in to a site with curl, the password input inside the form has the autofill=”off” tag and curl can’t fill in the password.

<input autocomplete="on" name="password" type="password">

$data = array(
        'username' => 'user',
        'password' => 'pw'
));


function post($url, $data, $ch)
{
    curl_setopt ($ch, CURLOPT_URL,$url); 
    curl_setopt ($ch, CURLOPT_POST, 1); 
    curl_setopt ($ch, CURLOPT_POSTFIELDS, $data);
    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
    $result= curl_exec($ch);
    return $result;
}
post();

I can’t figure out how to make this work. I would appreciate help.