2014-07-10 2 views
2

Я ищу, чтобы переместить несколько сайтов на новый сервер под управлением php55 и pecl 2. К сожалению, pecl 2 является массовым изменением от предыдущей версии и обеспечивает 0 обратную совместимость.Преобразование функции из pecl 1 в pecl 2

Я пытаюсь воссоздать следующее в pecl 2 с абсолютно никакой удачей, если кто-то может предложить предложение, было бы весьма полезно.

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

Cheers.

ответ

2

Прошло некоторое время, но он работал так.

//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();