HTTP_Request2 バージョンがあがってインターフェイスが変わったので多分この記事の内容はもうあまり役に立たないような気がします.(2010-03-21 追記) 0.1.0-alphaです。 PHP5 的な、HTTP_Requestの後継にあたる位置づけのようです。 なんか昨日HTTP_Requestを使おうとおもってマニュアル見ようとしたら見つけました。びっくり。 主な違い 主な違いは多分以下のかんじです。 Adapterが選択できるようになった 今のところ、Socket、cURL、Mock Mockはテスト用に使える インターフェースがちょっと使いやすくなった 例外なげてくれるようになった Net_URL2に依存 これまでのHTTP_Requestを知っている人は、若干使い方が違うので注意が必要です。まあ似たようなものですが。 使い方 サンプルコード <?php require
<?php include 'HTTP/Request2.php'; try { $req = new HTTP_Request2(<URL>, HTTP_Request2::METHOD_POST); $req->setAuth(<ID>, <パスワード>, HTTP_Request2::AUTH_BASIC); $data = array( 'status' => 'テスト。', 'source' => 'API-Test' ); $req->addPostParameter($data); $response = $req->send(); echo '<pre>'.htmlspecialchars($response->getBody()).'</pre>'; } catch (HTTP_Request2_Exception $e) { die($e->getMessage());
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く