[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

php hex code for cookie authentication to controller?

per 5.1 Authentication in control-spec.txt: "To authenticate, the controller must send the contents of this file, encoded in hexadecimal."
Fine, but when using the following in PHP:
$ch = fopen('cookiefilename', 'r');
$auth_value = fread($ch, 128);
$send_auth_value = "AUTHENTICATE \"". bin2hex($auth_value) . "\"\r\n";
$fh = fsockopen('', controlportnumber);
fwrite($fh, $send_auth_value);
$buf = fgets($fh);
... I get 515 Authentication failed: Wrong length on authentication cookie. 
Anyone help me with this? Thanks.