Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/241.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 将函数从pecl 1转换为pecl 2_Php_Pecl - Fatal编程技术网

Php 将函数从pecl 1转换为pecl 2

Php 将函数从pecl 1转换为pecl 2,php,pecl,Php,Pecl,我希望将一些站点转移到运行php55和pecl2的新服务器上。不幸的是,PECL2与以前的版本相比是一个巨大的变化,提供了0向后兼容性 我试图在pecl 2中重现以下内容,但绝对没有运气,如果有人能提供建议,我将不胜感激 $retVal = http_parse_message(http_post_fields("http://$wgserver/trusted", $params))->body; 干杯。花了一段时间,但它是这样工作的 //Set the params for post

我希望将一些站点转移到运行php55和pecl2的新服务器上。不幸的是,PECL2与以前的版本相比是一个巨大的变化,提供了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();