Skip to content
forked from weird/HttpClient

php使用socket模拟post、get操作,支持http、socket4、5代理

Notifications You must be signed in to change notification settings

bigxu/HttpClient

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 

Repository files navigation

GET请求

$http = new HttpClient();
$http->set_header('User-Agent','Mozilla/5.0 (Windows NT 5.1; rv:13.0) Gecko/20100101 Firefox/13.0.1'); 
$http->get('http://www.example.com/'); 
echo $http->get_body(); 

POST请求

$http = new HttpClient(); 
$http->set_header('User-Agent','Mozilla/5.0 (Windows NT 5.1; rv:13.0) Gecko/20100101 Firefox/13.0.1'); 
$data = array( 
	'id'=>1, 
	'name'=>'example' 	
); 
$file = array( 
	'photo'=>'/data/patch/file.jpg' 
); 
$http->post('http://www.example.com/',array($data)[,$file]); 
echo $http->get_body(); 

Cookie支持

$http->set_cookies($cookie); 

代理支持

$http->set_proxy('socks5.example.com:1080',HttpClient::PROXY_SOCKS5,'user','password'); 

About

php使用socket模拟post、get操作,支持http、socket4、5代理

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%