是否可以使用 Guzzle 在外部套接字上写入?
Is it possible to write on an external socket using Guzzle?
这是我的用例,我想转换这个 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 库进行类似的操作。
我知道 Guzzle 有一个 Stream class,我们可以将其作为请求的 "body" 发送,但我什至不知道 Guzzle 是否允许使用除 [=21] 之外的其他协议=]...
这里有 Guzzle 专家吗? :)
支持自定义协议似乎超出了像 Guzzle 这样的 HTTP 客户端的范围。
您要向该端点发送 HTTP 消息吗?如果是这样,你为什么不能使用 https?如果没有,您想使用 Guzzle 的哪些功能?大多数库都是特定于 HTTP 的。
这是我的用例,我想转换这个 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 库进行类似的操作。
我知道 Guzzle 有一个 Stream class,我们可以将其作为请求的 "body" 发送,但我什至不知道 Guzzle 是否允许使用除 [=21] 之外的其他协议=]...
这里有 Guzzle 专家吗? :)
支持自定义协议似乎超出了像 Guzzle 这样的 HTTP 客户端的范围。
您要向该端点发送 HTTP 消息吗?如果是这样,你为什么不能使用 https?如果没有,您想使用 Guzzle 的哪些功能?大多数库都是特定于 HTTP 的。