选择语言 :

Module_HttpClient_Driver_Fsock

Http请求Fsock驱动核心类

常量
HttpClient_Driver_Fsock::ERROR_HOST string(18) "请求的URL错误"
HttpClient_Driver_Fsock::ERROR_GET string(15) "GET请求错误"
HttpClient_Driver_Fsock::ERROR_POST string(16) "POST请求错误"
author
呼吸二氧化碳 jonwang@myqee.com
category
Module
package
HttpClient
copyright
Copyright © 2008-2013 myqee.com
license
http://www.myqee.com/license.html

$this->__construct( )


$this->set_agent( $agent )

设置$cookie

参数列表

参数 类型 描述 默认值
$agent $agent
返回值
  • HttpClient_Driver_Fsock

$this->set_cookies( $cookies )

设置$cookie

参数列表

参数 类型 描述 默认值
$cookies string $cookie
返回值
  • HttpClient_Driver_Fsock

$this->set_referer( $referer )

设置$referer

参数列表

参数 类型 描述 默认值
$referer string $referer
返回值
  • HttpClient_Driver_Fsock

$this->set_ip( $ip )

设置IP

参数列表

参数 类型 描述 默认值
$ip string $ip
返回值
  • HttpClient_Driver_Fsock

$this->set_header( $header )

设置Header

参数列表

参数 类型 描述 默认值
$header string $header
返回值
  • HttpClient_Driver_Curl

$this->set_option( $key , $value )

设置curl参数

//TODO 不支持自定义参数

参数列表

参数 类型 描述 默认值
$key string $key
$value value $value
返回值
  • HttpClient_Driver_Fsock

$this->set_multi_max_num( $num = 0)

设置多个列队默认排队数上限

参数列表

参数 类型 描述 默认值
$num int $num integer 0
返回值
  • HttpClient_Driver_Fsock

$this->method( $method = null)

设置,获取REST的类型

参数列表

参数 类型 描述 默认值
$method string GET|POST|DELETE|PUT 等,不传则返回当前method null
返回值
  • string
  • HttpClient_Driver_Fsock

$this->post( $url , $vars , $timeout = 60)

用POST方式提交,支持多个URL

$urls = array ( 'http://www.baidu.com/', 'http://mytest.com/url', 'http://www.abc.com/post', ); $data = array ( array('k1'=>'v1','k2'=>'v2'), array('a'=>1,'b'=>2), 'aa=1&bb=3&cc=3', ); HttpClient::factory()->post($url,$data);

参数列表

参数 类型 描述 默认值
$url $url
$vars string/array $vars
$timeout $timeout 超时时间,默认120秒 integer 60
返回值
  • string, false on failure

$this->get( $url , $timeout = 10)

GET方式获取数据,支持多个URL

参数列表

参数 类型 描述 默认值
$url string/array $url
$timeout $timeout integer 10
返回值
  • string, false on failure

$this->put( $url , $vars , $timeout = 10)

PUT方式获取数据,支持多个URL

参数列表

参数 类型 描述 默认值
$url string/array $url
$vars string/array $vars
$timeout $timeout integer 10
返回值
  • string, false on failure

$this->delete( $url , $vars , $timeout = 10)

DELETE方式获取数据,支持多个URL

参数列表

参数 类型 描述 默认值
$url string/array $url
$vars string/array $vars
$timeout $timeout integer 10
返回值
  • string, false on failure

$this->_create( $url , $timeout )

创建一个CURL对象

参数列表

参数 类型 描述 默认值
$url string URL地址
$timeout int 超时时间
返回值
  • fsockopen()

$this->request_urls( $urls , $timeout = 10)

支持多线程获取网页

参数列表

参数 类型 描述 默认值
$urls Array/string $urls
$timeout Int $timeout integer 10
返回值
  • Array