How can I connect to redis using php but without use a client library -
i'd know way connect redis using php scratch (without use client predis)?
thanks.
you can connect using fsockopen
, communicate sending raw commands , reading server response:
$c = fsockopen('127.0.0.1', 6379, $errcode, $errstr); $rawcommand = "*2\r\n\$4\r\necho\r\n\$12\r\nhello world!\r\n"; fwrite($c, $rawcommand); $rawresponse = fgets($c); echo $rawresponse; // $12 $rawresponse = fgets($c); echo $rawresponse; // hello world!
to use way, should familiar redis protocol: http://redis.io/topics/protocol
Comments
Post a Comment