[Ô´´] PHP ¼æÈÝ Curl/Socket/Stream µÄ HTTP ²Ù×÷Àà
<?php
/************************************************************
* ÃèÊö£ºHTTP²Ù×÷Àà
* ×÷Õߣºheiyeluren
* ´´½¨£º2009/12/13 04:43
* Ð޸ģº2009/12/16 10:30 ʵÏÖ»ù±¾HTTP¸÷ÖÖ½Ó¿Ú²Ù×÷Ö§³Ö
*
************************************************************/
/**
* HTTP¹¦Äܹ¤³§·½·¨Àà
*
* µ÷ÓÃʾÀý´úÂ룺
try {
$http = Http::factory('http://www.baidu.com', Http::TYPE_SOCK );
echo $http->get();
$http = Http::factory('http://127.0.0.1/test/i.php', Http::TYPE_SOCK );
echo $http->post('', array('user'=>'ÎÒÃÇ', 'nick'=>'ASSADF@#!32812989+-239%ASDF'), '', array('aa'=>'bb', 'cc'=>'dd'));
} catch (Exception $e) {
echo $e->getMessage();
}
*/
class Http
{
/**
* @var ʹÓà CURL
*/
const TYPE_CURL = 1;
/**
* @var ʹÓà Socket
*/
const TYPE_SOCK = 2;
/**
* @var ʹÓà Stream
*/
const TYPE_STREAM = 3;
/**
* ±£Ö¤¶ÔÏó²»±»clone
*/
private function __clone() {}
/**
* ¹¹Ô캯Êý
*/
private function __construct() {}
/**
* HTTP¹¤³§²Ù×÷·½·¨
*
* @param string $url ÐèÒª·ÃÎʵÄURL
* @param int $type ÐèҪʹÓõÄHTTPÀà
* @return object
*/
public static function factory($url = '', $type = self::TYPE_SOCK){
if ($type == ''){
$type = self::TYPE_SOCK;
}
switch($type) {
case self::TYPE_CURL :
if (!function_exists('curl_init')){
throw new Exception(__CLASS__ . " PHP CURL extension not install");
}
$obj = Http_Curl::getInstance($url);
break;
case self::TYPE_SOCK :
if (!function_exists('fsockopen')){
throw new Exception(__CLASS__ . " PHP function fsockopen() not support");
}
$obj = Http_Sock::getInstance($url);
break;
case self::TYPE_STREAM :
if (!function_exists('stream_context_create')){
throw new Exception(__CLASS__ . " PHP Stream extension not install");
}
$obj = Http_Stream::getInstance($url);
break;
default:
throw new Exception("http acc
Ïà¹ØÎĵµ£º
<?php
//н¨Ä¿Â¼
mkdir("/path/to/my/dir", 0700); //0700±íʾȨÏÞ×î´ó
//ɾ³ýĿ¼
rmdir("/path/to/my/dir");
//±éÀúĿ¼
$p =dir(/etc/php5);
echo "handler:".$p->handler;
while(false!=$entry=$p->read()){
echo $entry."\n" ;
}
$p->close();
//Êä³öÎļþÄÚÈÝ
$handle=@ ......
Submitted by gouki
on 2008, December 28, 9:00 PM. PHP
ÎÄÕµÄÄÚÈÝдµÄ²»´í£¬ËùÒÔתÔØһϡ£
ÔÎÄ£ºhttp://xinsync.xju.edu.cn/index.php/archives/2946
ÄÚÈÝÈçÏ£º
XML/HTML´úÂë
¹ýÈ¥µ±ÔËÐÐÒ»¸ö´óµÄwebÓ¦ÓÃʱºòÒâζ×ÅÔËÐÐÒ»¸ö´óÐ͵Äweb·þÎñÆ÷¡£ÒòΪÄãµÄÓ¦ÓÃÎüÒýÁË´óÁ¿µÄÓû§£¬Ä㽫²»µÃ²»ÔÚÄãµÄ·þÎñÆ÷ÀïÔ ......
PHP]
;;;;;;;;;;;
; WARNING ;
;;;;;;;;;;;
; This is the default settings file for new PHPinstallations.
; By default, PHP installs itself with a configuration suitablefor
; development purposes, and *NOT* for production purposes.
; For several security-oriented considerations that should betak ......
string date ( string format [, int timestamp] ) //ÆäÖÐtimestampΪ¿ÉÑ¡£¬Ä¬ÈÏֵΪtime();
date("1"); //Monday
date("m.d.y"); //12.21.09
date("m.d.Y");//12.21.2009
$tomorrow = mktime(0, 0, 0, date("m") , date("d")+1, date("Y"));
$las ......
×Ô¼º±àд»ùÓÚMVCµÄÇáÁ¿¼¶PHP¿ò¼Ü
2008-4-3 23:33:56 Òѱ»ÔĶÁ£º
477 ·¢±íÆÀÂÛ
×öWEB¿ª·¢ÒÑÓÐÒ»Äê,ÿ´Î¶¼Ð´Öظ´µÄ¶«Î÷, Òò´Ë,Ïë×Ô¼ºÐ´Ò»Ï¿ò¼Ü,ÒԺ󿪷¢·½±ã.
±¾ÈË֮ǰѧϰasp.NETÁ½Äê,JSP°ëÄê,¿ÉÊǺóÀ´ÒòΪ¹¤×÷µÄԹʻ»³ÉPHP.ÆäʵºÜ²»Ï²»¶PHPµÄÓï·¨.»¹ÓÐPHPµÄº¯ÊýÃû,ÿ»Ø¶¼Íü¼Ç..»¹ÊÇϲ
»¶C#ºÍJAVAµÄÓï·¨,¹þ...²» ......