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

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

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