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

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -