[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: php hex code for cookie authentication to controller?
On Tue, Oct 21, 2008 at 11:52:33AM -0700, Wesley Kenzie wrote:
> 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('127.0.0.1', controlportnumber);
> fwrite($fh, $send_auth_value);
> $buf = fgets($fh);
>
> ... I get 515 Authentication failed: Wrong length on authentication cookie.
What's the actual length of $auth_value? If it's not
AUTHENTICATION_COOKIE_LEN (32, I think), that's when I'd expect that
error.
Also, I don't know PHP so well, but maybe you should specify 'rb'
instead of 'r'.
--
Nick