<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>采集 &#8211; LPC影子技术分享</title>
	<atom:link href="https://www.mudbest.com/tag/%E9%87%87%E9%9B%86/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.mudbest.com</link>
	<description>行影不离,忘之却步.</description>
	<lastBuildDate>Mon, 01 Oct 2012 17:44:47 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.1</generator>
	<item>
		<title>PHP CURL采集简单案例</title>
		<link>https://www.mudbest.com/php-curl%e9%87%87%e9%9b%86%e7%ae%80%e5%8d%95%e6%a1%88%e4%be%8b/</link>
		
		<dc:creator><![CDATA[hkshadow]]></dc:creator>
		<pubDate>Fri, 03 Aug 2012 08:55:08 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[https]]></category>
		<category><![CDATA[采集]]></category>
		<guid isPermaLink="false">http://www.mudbest.com/?p=1158</guid>

					<description><![CDATA[如果想要做一个采集其他网站表单POST/GET后的数据，可以采用CURL的方法进行采集，即可得到想要的数据。]]></description>
										<content:encoded><![CDATA[<p>如果想要做一个采集其他网站表单POST/GET后的数据，可以采用CURL的方法进行采集，即可得到想要的数据。<span id="more-1158"></span></p>
<pre class="brush: php; title: ; notranslate">
// 模拟提交数据函数
function get_maxim_result_by_curl($key){	
	$url=&quot;http://shop.maxim-ic.com/storefront/viewpriceavailable.do?event=PartSearch&amp;Partnumber=$key&quot;;
	$cookie_file = dirname(__FILE__).'/cookie.txt';
	$ch = curl_init();// 启动一个CURL会话
	curl_setopt($ch, CURLOPT_URL,$url); // 要访问的地址
	curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 1.1.4322)');
	curl_setopt($ch, CURLOPT_COOKIEJAR,  $cookie_file); //伪COOKIE
	curl_setopt ( $ch, CURLOPT_FOLLOWLOCATION, 1 );// 使用自动跳转  如果关闭自动跳转则不报错。0关闭 1 开启
	curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);// 对认证证书来源的检查
	curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);// 从证书中检查SSL加密算法是否存在	
	//curl_setopt ( $ch, CURLOPT_POST, 1 ); // 发送一个常规的Post请求
	//curl_setopt ( $ch, CURLOPT_POSTFIELDS, $data ); // Post提交的数据包
	curl_setopt ( $curl, CURLOPT_TIMEOUT, 30); // 设置超时限制防止死循环
	//curl_setopt ( $curl, CURLOPT_HEADER, 0 ); // 显示返回的Header区域内容
	curl_setopt($ch, CURLOPT_SSLVERSION, 3);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);// 设为TRUE把curl_exec()结果转化为字符串，而不是直接输出
	$result = curl_exec($ch);// 执行操作
        if ( $result ) {
           echo 'Errno' . curl_error ( $ch); //捕抓异常
        }
	curl_close($ch); // 关闭CURL会话
	return $result; // 返回数据
}
//test
print_r(get_maxim_result_by_curl('1111'));
</pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>php curl正则采集</title>
		<link>https://www.mudbest.com/php-curl%e6%ad%a3%e5%88%99%e9%87%87%e9%9b%86/</link>
		
		<dc:creator><![CDATA[hkshadow]]></dc:creator>
		<pubDate>Tue, 03 Jul 2012 06:21:34 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[php curl]]></category>
		<category><![CDATA[采集]]></category>
		<guid isPermaLink="false">http://www.mudbest.com/?p=1122</guid>

					<description><![CDATA[Apache的httpd.conf配置： LoadModule php5_module &#34;../ph ... <a title="php curl正则采集" class="read-more" href="https://www.mudbest.com/php-curl%e6%ad%a3%e5%88%99%e9%87%87%e9%9b%86/" aria-label="阅读 php curl正则采集">阅读更多</a>]]></description>
										<content:encoded><![CDATA[<p>Apache的httpd.conf配置：</p>
<pre class="brush: plain; title: ; notranslate">
LoadModule php5_module &quot;../php/php5apache2_2.dll&quot;
PHPIniDir &quot;../php/&quot;
AddType application/x-httpd-php .php
LoadFile &quot;../php/libeay32.dll&quot;
LoadFile &quot;../php/ssleay32.dll&quot;
</pre>
<p>用于采集是一个不错的方法，以下资料来源于网上整理：<br />
PHP中的CURL函数库（Client URL Library Function）</p>
<p>curl_close &#8211; 关闭一个curl会话</p>
<p>curl_copy_handle &#8211; 拷贝一个curl连接资源的所有内容和参数</p>
<p>curl_errno &#8211; 返回一个包含当前会话错误信息的数字编号<span id="more-1122"></span></p>
<p>curl_error &#8211; 返回一个包含当前会话错误信息的字符串</p>
<p>curl_exec &#8211; 执行一个curl会话</p>
<p>curl_getinfo &#8211; 获取一个curl连接资源句柄的信息</p>
<p>curl_init &#8211; 初始化一个curl会话</p>
<p>curl_multi_add_handle &#8211; 向curl批处理会话中添加单独的curl句柄资源</p>
<p>curl_multi_close &#8211; 关闭一个批处理句柄资源</p>
<p>curl_multi_exec &#8211; 解析一个curl批处理句柄</p>
<p>curl_multi_getcontent &#8211; 返回获取的输出的文本流</p>
<p>curl_multi_info_read &#8211; 获取当前解析的curl的相关传输信息</p>
<p>curl_multi_init &#8211; 初始化一个curl批处理句柄资源</p>
<p>curl_multi_remove_handle &#8211; 移除curl批处理句柄资源中的某个句柄资源</p>
<p>curl_multi_select &#8211; Get all the sockets associated with the cURL extension, which can then be &#8220;selected&#8221;</p>
<p>curl_setopt_array &#8211; 以数组的形式为一个curl设置会话参数</p>
<p>curl_setopt &#8211; 为一个curl设置会话参数</p>
<p>curl_version &#8211; 获取curl相关的版本信息</p>
<p>curl_init()函数的作用初始化一个curl会话，curl_init()函数唯一的一个参数是可选的，表示一个url地址。</p>
<p>curl_exec()函数的作用是执行一个curl会话，唯一的参数是curl_init()函数返回的句柄。</p>
<p>curl_close()函数的作用是关闭一个curl会话，唯一的参数是curl_init()函数返回的句柄。</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
$ch = curl_init(&quot;http://www.baidu.com/&quot;);
curl_exec($ch);
curl_close($ch);
?&gt;
</pre>
<p>curl_version()函数的作用是获取curl相关的版本信息，curl_version()函数有一个参数，不清楚是做什么的</p>
<p>可设置的参数有：</p>
<p>CURLOPT_AUTOREFERER</p>
<p>自动设置header中的referer信息</p>
<p>CURLOPT_BINARYTRANSFER</p>
<p>在启用CURLOPT_RETURNTRANSFER时候将获取数据返回</p>
<p>CURLOPT_COOKIESESSION</p>
<p>启用时curl会仅仅传递一个session cookie，忽略其他的cookie，默认状况下curl会将所有的cookie返回给服务端。session cookie是指那些用来判断服务器端的session是否有效而存在的cookie。</p>
<p>CURLOPT_CRLF</p>
<p>启用时将Unix的换行符转换成回车换行符。</p>
<p>CURLOPT_DNS_USE_GLOBAL_CACHE</p>
<p>启用时会启用一个全局的DNS缓存，此项为线程安全的，并且默认为true。</p>
<p>CURLOPT_FAILONERROR</p>
<p>显示HTTP状态码，默认行为是忽略编号小于等于400的HTTP信息</p>
<p>CURLOPT_FILETIME</p>
<p>启用时会尝试修改远程文档中的信息。结果信息会通过curl_getinfo()函数的CURLINFO_FILETIME选项返回。</p>
<p>CURLOPT_FOLLOWLOCATION</p>
<p>启用时会将服务器服务器返回的&#8221;Location:&#8221;放在header中递归的返回给服务器，使用CURLOPT_MAXREDIRS可以限定递归返回的数量。</p>
<p>CURLOPT_FORBID_REUSE</p>
<p>在完成交互以后强迫断开连接，不能重用。</p>
<p>CURLOPT_FRESH_CONNECT</p>
<p>强制获取一个新的连接，替代缓存中的连接。</p>
<p>CURLOPT_FTP_USE_EPRT</p>
<p>TRUE to use EPRT (and LPRT) when doing active FTP downloads. Use FALSE to disable EPRT and LPRT and use PORT only.</p>
<p>Added in PHP 5.0.0.</p>
<p>CURLOPT_FTP_USE_EPSV</p>
<p>TRUE to first try an EPSV command for FTP transfers before reverting back to PASV. Set to FALSE to disable EPSV.</p>
<p>CURLOPT_FTPAPPEND</p>
<p>TRUE to append to the remote file instead of overwriting it.</p>
<p>CURLOPT_FTPASCII</p>
<p>An alias of CURLOPT_TRANSFERTEXT. Use that instead.</p>
<p>CURLOPT_FTPLISTONLY</p>
<p>TRUE to only list the names of an FTP directory.</p>
<p>CURLOPT_HEADER</p>
<p>启用时会将头文件的信息作为数据流输出。</p>
<p>CURLOPT_HTTPGET</p>
<p>启用时会设置HTTP的method为GET，因为GET是默认是，所以只在被修改的情况下使用。</p>
<p>CURLOPT_HTTPPROXYTUNNEL</p>
<p>启用时会通过HTTP代理来传输。</p>
<p>CURLOPT_MUTE</p>
<p>讲curl函数中所有修改过的参数恢复默认值。</p>
<p>CURLOPT_NETRC</p>
<p>在连接建立以后，访问~/.netrc文件获取用户名和密码信息连接远程站点。</p>
<p>CURLOPT_NOBODY</p>
<p>启用时将不对HTML中的body部分进行输出。</p>
<p>CURLOPT_NOPROGRESS</p>
<p>启用时关闭curl传输的进度条，此项的默认设置为true</p>
<p>CURLOPT_NOSIGNAL</p>
<p>启用时忽略所有的curl传递给php进行的信号。在SAPI多线程传输时此项被默认打开。</p>
<p>CURLOPT_POST</p>
<p>启用时会发送一个常规的POST请求，类型为：application/x-www-form-urlencoded，就像表单提交的一样。</p>
<p>CURLOPT_PUT</p>
<p>启用时允许HTTP发送文件，必须同时设置CURLOPT_INFILE和CURLOPT_INFILESIZE</p>
<p>CURLOPT_RETURNTRANSFER</p>
<p>讲curl_exec()获取的信息以文件流的形式返回，而不是直接输出。</p>
<p>CURLOPT_SSL_VERIFYPEER</p>
<p>FALSE to stop cURL from verifying the peer&#8221;s certificate. Alternate certificates to verify against can be specified with the CURLOPT_CAINFO option or a certificate directory can be specified with the CURLOPT_CAPATH option. CURLOPT_SSL_VERIFYHOST may also need to be TRUE or FALSE if CURLOPT_SSL_VERIFYPEER is disabled (it defaults to 2). TRUE by default as of cURL 7.10. Default bundle installed as of cURL 7.10.</p>
<p>CURLOPT_TRANSFERTEXT</p>
<p>TRUE to use ASCII mode for FTP transfers. For LDAP, it retrieves data in plain text instead of HTML. On Windows systems, it will not set STDOUT to binary mode.</p>
<p>CURLOPT_UNRESTRICTED_AUTH</p>
<p>在使用CURLOPT_FOLLOWLOCATION产生的header中的多个locations中持续追加用户名和密码信息，即使域名已发生改变。</p>
<p>CURLOPT_UPLOAD</p>
<p>启用时允许文件传输</p>
<p>CURLOPT_VERBOSE</p>
<p>启用时会汇报所有的信息，存放在STDERR或指定的CURLOPT_STDERR中</p>
<p>CURLOPT_BUFFERSIZE</p>
<p>每次获取的数据中读入缓存的大小，这个值每次都会被填满。</p>
<p>CURLOPT_CLOSEPOLICY</p>
<p>不是CURLCLOSEPOLICY_LEAST_RECENTLY_USED就是CURLCLOSEPOLICY_OLDEST，还存在另外三个，但是curl暂时还不支持。.</p>
<p>CURLOPT_CONNECTTIMEOUT</p>
<p>在发起连接前等待的时间，如果设置为0，则不等待。</p>
<p>CURLOPT_DNS_CACHE_TIMEOUT</p>
<p>设置在内存中保存DNS信息的时间，默认为120秒。</p>
<p>CURLOPT_FTPSSLAUTH</p>
<p>The FTP authentication method (when is activated): CURLFTPAUTH_SSL (try SSL first), CURLFTPAUTH_TLS (try TLS first), or CURLFTPAUTH_DEFAULT (let cURL decide).</p>
<p>CURLOPT_HTTP_VERSION</p>
<p>设置curl使用的HTTP协议，CURL_HTTP_VERSION_NONE（让curl自己判断），CURL_HTTP_VERSION_1_0（HTTP/1.0），CURL_HTTP_VERSION_1_1（HTTP/1.1）</p>
<p>CURLOPT_HTTPAUTH</p>
<p>使用的HTTP验证方法，可选的值有：CURLAUTH_BASIC，CURLAUTH_DIGEST，CURLAUTH_GSSNEGOTIATE， CURLAUTH_NTLM，CURLAUTH_ANY，CURLAUTH_ANYSAFE，可以使用&#8221;|&#8221;操作符分隔多个值，curl让服务器选择一个 支持最好的值，CURLAUTH_ANY等价于CURLAUTH_BASIC | CURLAUTH_DIGEST | CURLAUTH_GSSNEGOTIATE | CURLAUTH_NTLM，CURLAUTH_ANYSAFE等价于CURLAUTH_DIGEST | CURLAUTH_GSSNEGOTIATE | CURLAUTH_NTLM</p>
<p>CURLOPT_INFILESIZE</p>
<p>设定上传文件的大小</p>
<p>CURLOPT_LOW_SPEED_LIMIT</p>
<p>当传输速度小于CURLOPT_LOW_SPEED_LIMIT时，PHP会根据CURLOPT_LOW_SPEED_TIME来判断是否因太慢而取消传输。</p>
<p>CURLOPT_LOW_SPEED_TIME</p>
<p>The number of seconds the transfer should be below CURLOPT_LOW_SPEED_LIMIT for PHP to consider the transfer too slow and abort.</p>
<p>当传输速度小于CURLOPT_LOW_SPEED_LIMIT时，PHP会根据CURLOPT_LOW_SPEED_TIME来判断是否因太慢而取消传输。</p>
<p>CURLOPT_MAXCONNECTS</p>
<p>允许的最大连接数量，超过是会通过CURLOPT_CLOSEPOLICY决定应该停止哪些连接</p>
<p>CURLOPT_MAXREDIRS</p>
<p>指定最多的HTTP重定向的数量，这个选项是和CURLOPT_FOLLOWLOCATION一起使用的。</p>
<p>CURLOPT_PORT</p>
<p>一个可选的用来指定连接端口的量</p>
<p>CURLOPT_PROXYAUTH</p>
<p>The HTTP authentication method(s) to use for the proxy connection. Use the same bitmasks as described in CURLOPT_HTTPAUTH. For proxy authentication, only CURLAUTH_BASIC and CURLAUTH_NTLM are currently supported.</p>
<p>CURLOPT_PROXYPORT</p>
<p>The port number of the proxy to connect to. This port number can also be set in CURLOPT_PROXY.</p>
<p>CURLOPT_PROXYTYPE</p>
<p>Either CURLPROXY_HTTP (default) or CURLPROXY_SOCKS5.</p>
<p>CURLOPT_RESUME_FROM</p>
<p>在恢复传输时传递一个字节偏移量（用来断点续传）</p>
<p>CURLOPT_SSL_VERIFYHOST</p>
<p>1 to check the existence of a common name in the SSL peer certificate.</p>
<p>2 to check the existence of a common name and also verify that it matches the hostname provided.</p>
<p>CURLOPT_SSLVERSION</p>
<p>The SSL version (2 or 3) to use. By default PHP will try to determine this itself, although in some cases this must be set manually.</p>
<p>CURLOPT_TIMECONDITION</p>
<p>如果在CURLOPT_TIMEVALUE指定的某个时间以后被编辑过，则使用CURL_TIMECOND_IFMODSINCE返回页面，如果没有被修 改过，并且CURLOPT_HEADER为true，则返回一个&#8221;304 Not Modified&#8221;的header，CURLOPT_HEADER为false，则使用CURL_TIMECOND_ISUNMODSINCE，默认值为 CURL_TIMECOND_IFMODSINCE</p>
<p>CURLOPT_TIMEOUT</p>
<p>设置curl允许执行的最长秒数</p>
<p>CURLOPT_TIMEVALUE</p>
<p>设置一个CURLOPT_TIMECONDITION使用的时间戳，在默认状态下使用的是CURL_TIMECOND_IFMODSINCE</p>
<p>CURLOPT_CAINFO</p>
<p>The name of a file holding one or more certificates to verify the peer with. This only makes sense when used in combination with CURLOPT_SSL_VERIFYPEER.</p>
<p>CURLOPT_CAPATH</p>
<p>A directory that holds multiple CA certificates. Use this option alongside CURLOPT_SSL_VERIFYPEER.</p>
<p>CURLOPT_COOKIE</p>
<p>设定HTTP请求中&#8221;Set-Cookie:&#8221;部分的内容。</p>
<p>CURLOPT_COOKIEFILE</p>
<p>包含cookie信息的文件名称，这个cookie文件可以是Netscape格式或者HTTP风格的header信息。</p>
<p>CURLOPT_COOKIEJAR</p>
<p>连接关闭以后，存放cookie信息的文件名称</p>
<p>CURLOPT_CUSTOMREQUEST</p>
<p>A custom request method to use instead of &#8220;GET&#8221; or &#8220;HEAD&#8221; when doing a HTTP request. This is useful for doing &#8220;Delete&#8221; or other, more obscure HTTP requests. Valid values are things like &#8220;GET&#8221;, &#8220;POST&#8221;, &#8220;CONNECT&#8221; and so on; i.e. Do not enter a whole HTTP request line here. For instance, entering &#8220;GET /index.html HTTP/1.0\r\n\r\n&#8221; would be incorrect.</p>
<p>Note: Don&#8221;t do this without making sure the server supports the custom request method first.</p>
<p>CURLOPT_EGBSOCKET</p>
<p>Like CURLOPT_RANDOM_FILE, except a filename to an Entropy Gathering Daemon socket.</p>
<p>CURLOPT_ENCODING</p>
<p>header中&#8221;Accept-Encoding: &#8220;部分的内容，支持的编码格式为：&#8221;identity&#8221;，&#8221;deflate&#8221;，&#8221;gzip&#8221;。如果设置为空字符串，则表示支持所有的编码格式</p>
<p>CURLOPT_FTPPORT</p>
<p>The value which will be used to get the IP address to use for the FTP &#8220;POST&#8221; instruction. The &#8220;POST&#8221; instruction tells the remote server to connect to our specified IP address. The string may be a plain IP address, a hostname, a network interface name (under Unix), or just a plain &#8221;-&#8221; to use the systems default IP address.</p>
<p>CURLOPT_INTERFACE</p>
<p>在外部网络接口中使用的名称，可以是一个接口名，IP或者主机名。</p>
<p>CURLOPT_KRB4LEVEL</p>
<p>KRB4(Kerberos 4)安全级别的设置，可以是一下几个值之一：&#8221;clear&#8221;，&#8221;safe&#8221;，&#8221;confidential&#8221;，&#8221;private&#8221;。默认的值为 &#8220;private&#8221;，设置为null的时候表示禁用KRB4，现在KRB4安全仅能在FTP传输中使用。</p>
<p>CURLOPT_POSTFIELDS</p>
<p>在HTTP中的&#8221;POST&#8221;操作。如果要传送一个文件，需要一个@开头的文件名</p>
<p>CURLOPT_PROXY</p>
<p>设置通过的HTTP代理服务器</p>
<p>CURLOPT_PROXYUSERPWD</p>
<p>连接到代理服务器的，格式为&#8221;[username]:[password]&#8221;的用户名和密码。</p>
<p>CURLOPT_RANDOM_FILE</p>
<p>设定存放SSL用到的随机数种子的文件名称</p>
<p>CURLOPT_RANGE</p>
<p>设置HTTP传输范围，可以用&#8221;X-Y&#8221;的形式设置一个传输区间，如果有多个HTTP传输，则使用逗号分隔多个值，形如：&#8221;X-Y,N-M&#8221;。</p>
<p>CURLOPT_REFERER</p>
<p>设置header中&#8221;Referer: &#8221; 部分的值。</p>
<p>CURLOPT_SSL_CIPHER_LIST</p>
<p>A list of ciphers to use for SSL. For example, RC4-SHA and TLSv1 are valid cipher lists.</p>
<p>CURLOPT_SSLCERT</p>
<p>传递一个包含PEM格式证书的字符串。</p>
<p>CURLOPT_SSLCERTPASSWD</p>
<p>传递一个包含使用CURLOPT_SSLCERT证书必需的密码。</p>
<p>CURLOPT_SSLCERTTYPE</p>
<p>The format of the certificate. Supported formats are &#8220;PEM&#8221; (default), &#8220;DER&#8221;, and &#8220;ENG&#8221;.</p>
<p>CURLOPT_SSLENGINE</p>
<p>The identifier for the crypto engine of the private SSL key specified in CURLOPT_SSLKEY.</p>
<p>CURLOPT_SSLENGINE_DEFAULT</p>
<p>The identifier for the crypto engine used for asymmetric crypto operations.</p>
<p>CURLOPT_SSLKEY</p>
<p>The name of a file containing a private SSL key.</p>
<p>CURLOPT_SSLKEYPASSWD</p>
<p>The secret password needed to use the private SSL key specified in CURLOPT_SSLKEY.</p>
<p>Note: Since this option contains a sensitive password, remember to keep the PHP script it is contained within safe.</p>
<p>CURLOPT_SSLKEYTYPE</p>
<p>The key type of the private SSL key specified in CURLOPT_SSLKEY. Supported key types are &#8220;PEM&#8221; (default), &#8220;DER&#8221;, and &#8220;ENG&#8221;.</p>
<p>CURLOPT_URL</p>
<p>需要获取的URL地址，也可以在PHP的curl_init()函数中设置。</p>
<p>CURLOPT_USERAGENT</p>
<p>在HTTP请求中包含一个&#8221;user-agent&#8221;头的字符串。</p>
<p>CURLOPT_USERPWD</p>
<p>传递一个连接中需要的用户名和密码，格式为：&#8221;[username]:[password]&#8221;。</p>
<p>CURLOPT_HTTP200ALIASES</p>
<p>设置不再以error的形式来处理HTTP 200的响应，格式为一个数组。</p>
<p>CURLOPT_HTTPHEADER</p>
<p>设置一个header中传输内容的数组。</p>
<p>CURLOPT_POSTQUOTE</p>
<p>An array of FTP commands to execute on the server after the FTP request has been performed.</p>
<p>CURLOPT_QUOTE</p>
<p>An array of FTP commands to execute on the server prior to the FTP request.</p>
<p>CURLOPT_FILE</p>
<p>设置输出文件的位置，值是一个资源类型，默认为STDOUT (浏览器)。</p>
<p>CURLOPT_INFILE</p>
<p>在上传文件的时候需要读取的文件地址，值是一个资源类型。</p>
<p>CURLOPT_STDERR</p>
<p>设置一个错误输出地址，值是一个资源类型，取代默认的STDERR。</p>
<p>CURLOPT_WRITEHEADER</p>
<p>设置header部分内容的写入的文件地址，值是一个资源类型。</p>
<p>CURLOPT_HEADERFUNCTION</p>
<p>设置一个回调函数，这个函数有两个参数，第一个是curl的资源句柄，第二个是输出的header数据。header数据的输出必须依赖这个函数，返回已写入的数据大小。</p>
<p>CURLOPT_PASSWDFUNCTION</p>
<p>设置一个回调函数，有三个参数，第一个是curl的资源句柄，第二个是一个密码提示符，第三个参数是密码长度允许的最大值。返回密码的值。</p>
<p>CURLOPT_READFUNCTION</p>
<p>设置一个回调函数，有两个参数，第一个是curl的资源句柄，第二个是读取到的数据。数据读取必须依赖这个函数。返回读取数据的大小，比如0或者EOF。</p>
<p>CURLOPT_WRITEFUNCTION</p>
<p>设置一个回调函数，有两个参数，第一个是curl的资源句柄，第二个是写入的数据。数据写入必须依赖这个函数。返回精确的已写入数据的大小</p>
<p>curl_copy_handle()函数的作用是拷贝一个curl连接资源的所有内容和参数</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
$ch = curl_init(&quot;http://www.baidu.com/&quot;);
$another = curl_copy_handle($ch);
curl_exec($another);
curl_close($another);
?&gt;
</pre>
<p>curl_error()函数的作用是返回一个包含当前会话错误信息的字符串。</p>
<p>curl_errno()函数的作用是返回一个包含当前会话错误信息的数字编号。</p>
<p>curl_multi_init()函数的作用是初始化一个curl批处理句柄资源。</p>
<p>curl_multi_add_handle()函数的作用是向curl批处理会话中添加单独的curl句柄资源。curl_multi_add_handle()函数有两个参数，第一个参数表示一个curl批处理句柄资源，第二个参数表示一个单独的curl句柄资源。</p>
<p>curl_multi_exec()函数的作用是解析一个curl批处理句柄，curl_multi_exec()函数有两个参数，第一个参数表示一个批处理句柄资源，第二个参数是一个引用值的参数，表示剩余需要处理的单个的curl句柄资源数量。</p>
<p>curl_multi_remove_handle()函数表示移除curl批处理句柄资源中的某个句柄资源， curl_multi_remove_handle()函数有两个参数，第一个参数表示一个curl批处理句柄资源，第二个参数表示一个单独的curl句 柄资源。</p>
<p>curl_multi_close()函数的作用是关闭一个批处理句柄资源。</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
$ch1 = curl_init();
$ch2 = curl_init();
curl_setopt($ch1, CURLOPT_URL, &quot;http://www.baidu.com/&quot;);
curl_setopt($ch1, CURLOPT_HEADER, 0);
curl_setopt($ch2, CURLOPT_URL, &quot;http://www.google.com/&quot;);
curl_setopt($ch2, CURLOPT_HEADER, 0);
$mh = curl_multi_init();
curl_multi_add_handle($mh,$ch1);
curl_multi_add_handle($mh,$ch2);
do {
curl_multi_exec($mh,$flag);
} while ($flag &gt; 0);

curl_multi_remove_handle($mh,$ch1);
curl_multi_remove_handle($mh,$ch2);
curl_multi_close($mh);
?&gt;
</pre>
<p>curl_multi_getcontent()函数的作用是在设置了CURLOPT_RETURNTRANSFER的情况下，返回获取的输出的文本流。</p>
<p>curl_multi_info_read()函数的作用是获取当前解析的curl的相关传输信息。</p>
<p>curl_multi_select()</p>
<p>Get all the sockets associated with the cURL extension, which can then be &#8220;selected&#8221; </p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
