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

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

2008年01月22日-はてなブックマーク

スポンサード リンク
[PR] 英単語を忘却曲線アプリを使って超効率よく記憶する方法
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認証、リダイレクト回数設定、クッキー制御などの基本的な機能にも対応しています。

ドキュメントはこちら

関連エントリ

関連の記事検索:PHP, JavaScript, php, info
スポンサード リンク

By.KJ : 2008年01月22日 10:01 livedoor Readerで購読 Twitterに投稿

間違いの指摘をしていただける方はメール、あるいはTwitter/FBでお願いします(クリック)