前の記事 «:PhotoShopのブラシやパターンがいっぱい「myphotoshopbrushes.com」
次の記事 »:CSSでdigg風のナビゲーションを実装サンプル

PHP用、外部接続にcURLかfsockopenが選べるHTTPクラス

2008年01月22日

スポンサード リンク
HTTP Class for PHP (supports both cURL and fsockopen) | Md Emran Hasan aka phpfour
This is a wrapper HTTP class that uses either cURL or fsockopen to harvest resources from the web.

PHP用、外部接続にcURLかfsockopenが選べるHTTPクラス。

次のようにPEARレスでシンプルに使えます。

<?php

include_once('class.http.php');

$http = new Http();
$http->useCurl(false);
$http->setMethod('POST');
$http->addParam('user_name', 'emran');
$http->addParam('password', 'hasan');
$http->setReferrer('https://someproject.projectpath.com/login');
$http->execute('https://someproject.projectpath.com/login/authenticate');
echo (
$http->error) ? $http->error : $http->result;

?>

リファラ送りやBasic認証、リダイレクト回数設定、クッキー制御などの基本的な機能にも対応しています。

ドキュメントはこちら

関連エントリ

スポンサード リンク

投稿者 KJ : 2008年01月22日 10:01 | ブックマークに追加する Subscribe with livedoor Reader
間違いの指摘をしていただける方はメールでお願いします


本を執筆しました。