8.8.2 post
The original text for this section has changed since it was translated. Please help resolve this difference. You can:
post メソッドはシンプルな HTTP POST のリクエストを作成し、リクエストの結果を返します。
string function post ($uri, $data, $request)
post メソッドは get とほとんど同じです。 $uri はリクエストを行うウェブアドレス、 $query は post するデータです。データは、文字列で "param1=foo¶m2=bar" としても、キー付きの配列で array('param1' => 'foo', 'param2' => 'bar') というようにしても、どちらでもかまいません。
App::import('Core', 'HttpSocket');
$HttpSocket = new HttpSocket();
$results = $HttpSocket->post('www.somesite.com/add', array('name' => 'test', 'type' => 'user');
//$results には post の結果が格納されます
App::import('Core', 'HttpSocket');$HttpSocket = new HttpSocket();$results = $HttpSocket->post('www.somesite.com/add', array('name' => 'test', 'type' => 'user');//$results には post の結果が格納されます


























