【发布时间】:2015-10-14 01:47:45
【问题描述】:
这是我的用例,我想转换这个 PHP 代码:
$ctx = stream_context_create(array(
'ssl' => array(
'local_cert' => $myLocalCert,
'passphrase' => $myPassphrase,
),
));
$stream = stream_socket_client(
'tls://gateway.sandbox.push.apple.com:2195',
$errno,
$errstr,
30,
STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT,
$ctx
);
fwrite($stream, $myMessage, strlen($myMessage));
使用伟大的Guzzle lib 进行类似的操作。
我知道 Guzzle 有一个 Stream 类,我们可以将其作为请求的“正文”发送,但我什至不知道 Guzzle 是否允许使用“http(s)”以外的其他协议...
这里有 Guzzle 专家吗? :)
【问题讨论】:
标签: php sockets curl stream guzzle