<?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>https &#8211; LPC影子技术分享</title>
	<atom:link href="https://www.mudbest.com/tag/https/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.mudbest.com</link>
	<description>行影不离,忘之却步.</description>
	<lastBuildDate>Mon, 01 Oct 2012 07:01:04 +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>
	</channel>
</rss>
