首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >将函数从pecl %1转换为pecl %2

将函数从pecl %1转换为pecl %2
EN

Stack Overflow用户
提问于 2014-07-10 22:40:59
回答 1查看 287关注 0票数 2

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

我正在尝试在pecl 2中重新创建以下内容,如果有人能提供建议,我们将不胜感激。

代码语言:javascript
复制
$retVal = http_parse_message(http_post_fields("http://$wgserver/trusted", $params))->body;

干杯。

EN

回答 1

Stack Overflow用户

发布于 2014-07-11 00:50:17

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

代码语言:javascript
复制
//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();
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24679494

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档