我希望将一些网站迁移到运行php55和PECL2的新服务器上。不幸的是,PECL2与之前的版本相比有了巨大的变化,并提供了0向后兼容性。
我正在尝试在pecl 2中重新创建以下内容,如果有人能提供建议,我们将不胜感激。
$retVal = http_parse_message(http_post_fields("http://$wgserver/trusted", $params))->body;干杯。
发布于 2014-07-11 00:50:17
花了一段时间,但让它以这种方式工作。
//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();https://stackoverflow.com/questions/24679494
复制相似问题