php - 将函数从 pecl 1 转换为 pecl 2

标签 php pecl

我希望将一些站点迁移到运行 php55 和 pecl 2 的新服务器。不幸的是,pecl 2 与以前的版本相比有巨大变化,并且提供 0 向后兼容性。

我正在尝试在 pecl 2 中重新创建以下内容,但绝对没有运气,如果有人可以提供建议,我们将不胜感激。

$retVal = http_parse_message(http_post_fields("http://$wgserver/trusted", $params))->body;

干杯。

最佳答案

花了一段时间,但还是以这种方式工作。

//Set the params for posting the relevant info to the server
$params = array(
  'username' => $user,
  'target_site'=>$targetSite
);

//Create the initial request
$request = new http\Client\Request("POST","http://$wgserver/trusted");
//Add the params to the body
$request->getBody()->append (new http\QueryString($params));
//Set the client
$client = new http\Client;
//Make the POST
$client->enqueue($request)->send();
//Capture the response
$response = $client->getResponse($request);
//Extract the body of the response (since that's what I need for this example)
$bod = $response->getBody();

关于php - 将函数从 pecl 1 转换为 pecl 2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24679494/

相关文章:

php - 使用 PHP 使用 UPDATE MySQL 更新数据库中的 blob 图像

php - 在 amazon linux 上为 PHP 安装 mongo 驱动程序时出错

php - 我使用 mailparse_msg_create 函数遇到 fatal error

php - 如何使用pecl solr扩展连接到mysql?

PHP CURL 与 PECL_HTTP

javascript - 带有验证和隐藏字段值的提交按钮

php - mysql查询在多列中选择数据

php - 使用 php 析构函数是否适合显示 HTML?

php - Facebook 喜欢的视频 uploader 在发布前生成缩略图

php - PECL bbcode 包构建失败