<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[张宴的博客]]></title> 
<link>http://zyan.cc/index.php</link> 
<description><![CDATA[Web系统架构与底层研发]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[张宴的博客]]></copyright>
<item>
<link>http://zyan.cc/post/285/</link>
<title><![CDATA[采用curl库在PHP程序之间传递数组[原创]]]></title> 
<author>张宴 &lt;net@s135.com&gt;</author>
<category><![CDATA[PHP/JS/Shell]]></category>
<pubDate>Thu, 16 Aug 2007 10:59:44 +0000</pubDate> 
<guid>http://zyan.cc/post/285/</guid> 
<description>
<![CDATA[ 
	　　[文章作者：张宴 本文版本：v1.1 最后修改：2007.08.23 转载请注明出处：<a href="http://blog.zyan.cc" target="_blank">http://blog.zyan.cc</a>]<br/><br/>　　最近在工作中遇到一个问题：a.php程序需要将接收到的数据同时写到“线上运行的正式数据库”和“进行开发调试的测试数据库”。而测试数据库可能经常会面临对表结构、字段、配置信息做调整等问题，很不稳定，发生错误的概率很高，如果用a.php程序同时写“正式数据库”和“测试数据库”，势必影响到线上运行的正式服务。<br/><br/>　　于是，我想到用PHP curl扩展库将生成的$data数组post传递一份给b.php程序，然后a.php程序继续往下执行写“正式数据库”的代码。a.php程序将$data数组传递给b.php程序就完事了，至于b.php如何处理，就不关a.php的事了，b.php程序即使写“测试数据库”失败，也不会对a.php程序造成影响。<br/><br/>　　<a href="http://zyan.cc/attachment/200708/curl.gif" target="_blank"><img src="http://zyan.cc/attachment/200708/curl.gif" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><br/>　　按照这种思路，我写了a.php和b.php的代码：<br/><br/>　　a.php程序源代码：<br/>............<br/><br/>Tags - <a href="http://zyan.cc/tags/php/" rel="tag">php</a>
]]>
</description>
</item><item>
<link>http://zyan.cc/post/285/#blogcomment695</link>
<title><![CDATA[[评论] 采用curl库在PHP程序之间传递数组[原创]]]></title> 
<author>sx &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 21 Feb 2008 07:27:00 +0000</pubDate> 
<guid>http://zyan.cc/post/285/#blogcomment695</guid> 
<description>
<![CDATA[ 
	实际这个就是一个同步改异步的问题，可以有很多种解决方案，为什么要使用curl，curl的方式会增加一个http连接，而且curl本身的实现也有诸多问题。
]]>
</description>
</item><item>
<link>http://zyan.cc/post/285/#blogcomment1136</link>
<title><![CDATA[[评论] 采用curl库在PHP程序之间传递数组[原创]]]></title> 
<author>少天 &lt;jstjob@gmail.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Fri, 06 Jun 2008 03:46:03 +0000</pubDate> 
<guid>http://zyan.cc/post/285/#blogcomment1136</guid> 
<description>
<![CDATA[ 
	顶下～<br/><br/>偶来寻求帮助来了 呵呵<br/>最近想用CURL实现获取邮件 联系人数据<br/><br/>弄了几天 出不来效果 教教我撒<br/><br/>MSN/GTALK ：jstjob@gmail.com
]]>
</description>
</item><item>
<link>http://zyan.cc/post/285/#blogcomment1840</link>
<title><![CDATA[[评论] 采用curl库在PHP程序之间传递数组[原创]]]></title> 
<author>jimmy &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Fri, 31 Oct 2008 05:39:34 +0000</pubDate> 
<guid>http://zyan.cc/post/285/#blogcomment1840</guid> 
<description>
<![CDATA[ 
	回忆未来，这一句 &nbsp;$get_data = file_get_contents(&quot;php://input&quot;); &nbsp;中的＂php://input ＂是？
]]>
</description>
</item><item>
<link>http://zyan.cc/post/285/#blogcomment1843</link>
<title><![CDATA[[评论] 采用curl库在PHP程序之间传递数组[原创]]]></title> 
<author>jimmy &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Fri, 31 Oct 2008 07:09:39 +0000</pubDate> 
<guid>http://zyan.cc/post/285/#blogcomment1843</guid> 
<description>
<![CDATA[ 
	恩,谢谢你的回复.我会一直向你学习的
]]>
</description>
</item><item>
<link>http://zyan.cc/post/285/#blogcomment1848</link>
<title><![CDATA[[评论] 采用curl库在PHP程序之间传递数组[原创]]]></title> 
<author>jimmy &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Fri, 31 Oct 2008 11:21:55 +0000</pubDate> 
<guid>http://zyan.cc/post/285/#blogcomment1848</guid> 
<description>
<![CDATA[ 
	那b.php,是怎么开始触发执行的呢
]]>
</description>
</item><item>
<link>http://zyan.cc/post/285/#blogcomment1872</link>
<title><![CDATA[[评论] 采用curl库在PHP程序之间传递数组[原创]]]></title> 
<author>jimmy &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Sun, 02 Nov 2008 06:30:03 +0000</pubDate> 
<guid>http://zyan.cc/post/285/#blogcomment1872</guid> 
<description>
<![CDATA[ 
	我的意思是,普通的form 会有个action,我们用curl来post后,它不action的,这怎么办?
]]>
</description>
</item><item>
<link>http://zyan.cc/post/285/#blogcomment1882</link>
<title><![CDATA[[评论] 采用curl库在PHP程序之间传递数组[原创]]]></title> 
<author>jimmy &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Mon, 03 Nov 2008 03:43:51 +0000</pubDate> 
<guid>http://zyan.cc/post/285/#blogcomment1882</guid> 
<description>
<![CDATA[ 
	呵呵,是这样,在我的小例子里,我是想在修改的时候应用下.在列表页中从数据库中提取出数据后,我点修改的时候,不想在去提取数据库,而是想直接从列表页传递过来,但我用get方式又行不通,因为数据量肯定是get所承受不起的,所以我想模拟一种post的方式在不用表单的情况下.说到普通form,提交后,会根据一个action的地址,到达一个处理页面.用curl来post的时候,就没有这种效果了.对吧,,所以我才问的这个,不知道我说明白了没,指点我下,继续关注
]]>
</description>
</item><item>
<link>http://zyan.cc/post/285/#blogcomment2037</link>
<title><![CDATA[[评论] 采用curl库在PHP程序之间传递数组[原创]]]></title> 
<author>hhlin &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Fri, 21 Nov 2008 15:03:16 +0000</pubDate> 
<guid>http://zyan.cc/post/285/#blogcomment2037</guid> 
<description>
<![CDATA[ 
	如果 a.php 放在 <a href="http://www.abc.com" target="_blank">www.abc.com</a> 根目录, b.php 放在 <a href="http://www.asd.com" target="_blank">www.asd.com</a> 根目录,<br/>那么访问 <a href="http://www.abc.com/a.php" target="_blank">http://www.abc.com/a.php</a> 触发不了 <a href="http://www.asd.com/b.php" target="_blank">http://www.asd.com/b.php</a><br/><br/>问题在哪里.
]]>
</description>
</item><item>
<link>http://zyan.cc/post/285/#blogcomment3579</link>
<title><![CDATA[[评论] 采用curl库在PHP程序之间传递数组[原创]]]></title> 
<author>DIY &lt;weichaoduo@hotmail.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Wed, 01 Jul 2009 03:44:02 +0000</pubDate> 
<guid>http://zyan.cc/post/285/#blogcomment3579</guid> 
<description>
<![CDATA[ 
	将此数组先序列化(serialize ,json)再传递不就好了????
]]>
</description>
</item><item>
<link>http://zyan.cc/post/285/#blogcomment4257</link>
<title><![CDATA[[评论] 采用curl库在PHP程序之间传递数组[原创]]]></title> 
<author>aiway &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 22 Oct 2009 06:49:43 +0000</pubDate> 
<guid>http://zyan.cc/post/285/#blogcomment4257</guid> 
<description>
<![CDATA[ 
	写的很好 支持 期待更多原创内容<br/>请问下，利用fsockopen() 和使用curl那个会更快些？<br/>a.php在发送数据的时候是否需要等待数据发送完呢？
]]>
</description>
</item><item>
<link>http://zyan.cc/post/285/#blogcomment4483</link>
<title><![CDATA[[评论] 采用curl库在PHP程序之间传递数组[原创]]]></title> 
<author>一叶轩 &lt;mylove8002@126.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Sat, 28 Nov 2009 07:32:46 +0000</pubDate> 
<guid>http://zyan.cc/post/285/#blogcomment4483</guid> 
<description>
<![CDATA[ 
	我用这个类去采我自己的一个页面（此页面已关闭allow_url_fopen，返回的只是一串简单的json代码）;<br/><br/>经过测试，这个类中的get就不好使了。<br/><br/>但是用这个取，就没有问题：<br/><br/>function curl_fetch($url) &#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$c = curl_init($url);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;curl_setopt($c, CURLOPT_TIMEOUT,10);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;curl_setopt($c, CURLOPT_CONNECTTIMEOUT,1);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;curl_setopt($c, CURLOPT_USERAGENT,&#039;Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3&#039;);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$content = curl_exec($c);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$err = curl_errno($c);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$info = curl_getinfo($c);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$succ = false;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (!$err &amp;&amp; isset($info[&#039;http_code&#039;]) &amp;&amp; 200 == $info[&#039;http_code&#039;]) &#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$succ = true;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//return array($succ, $content);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return $content;<br/>&nbsp;&nbsp;&#125;
]]>
</description>
</item><item>
<link>http://zyan.cc/post/285/#blogcomment4484</link>
<title><![CDATA[[评论] 采用curl库在PHP程序之间传递数组[原创]]]></title> 
<author>一叶轩 &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Sat, 28 Nov 2009 08:20:13 +0000</pubDate> 
<guid>http://zyan.cc/post/285/#blogcomment4484</guid> 
<description>
<![CDATA[ 
	不好意思，是我搞错了，是我在get时没有指定好USERAGENT，这个类很好用，谢谢分享!!!
]]>
</description>
</item><item>
<link>http://zyan.cc/post/285/#blogcomment6638</link>
<title><![CDATA[[评论] 采用curl库在PHP程序之间传递数组[原创]]]></title> 
<author>Hui &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Mon, 16 Aug 2010 04:40:23 +0000</pubDate> 
<guid>http://zyan.cc/post/285/#blogcomment6638</guid> 
<description>
<![CDATA[ 
	如果多维数组只能用json_encode了
]]>
</description>
</item><item>
<link>http://zyan.cc/post/285/#blogcomment10997</link>
<title><![CDATA[[评论] 采用curl库在PHP程序之间传递数组[原创]]]></title> 
<author>123 &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Fri, 28 Oct 2011 09:38:05 +0000</pubDate> 
<guid>http://zyan.cc/post/285/#blogcomment10997</guid> 
<description>
<![CDATA[ 
	如果我要模拟提交一个复选框的内容怎么做
]]>
</description>
</item><item>
<link>http://zyan.cc/post/285/#blogcomment18750</link>
<title><![CDATA[[评论] 采用curl库在PHP程序之间传递数组[原创]]]></title> 
<author>coach factory outlet &lt;fgf@hotmail.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 17 May 2012 03:00:53 +0000</pubDate> 
<guid>http://zyan.cc/post/285/#blogcomment18750</guid> 
<description>
<![CDATA[ 
	Today, following half a century, mentor leather-bases <a href="http://www.coachfactoryoutletao.net" target="_blank">coach factory outlet</a> continues to be the delicate craft of leather-based master is accountable for,Would you like to meet more friends, or go with the times? If yes, <a href="http://www.coachfactoryoutletao.net" target="_blank">coach factory online</a> is opening welcome doors to you.in the market you definitely can find various colorways that are designed in as well as the high quality that applied in. For most of you would like to come. So just come to our <a href="http://www.coachfactoryoutletao.net" target="_blank">coach factory outlet online</a> store to choose one.
]]>
</description>
</item>
</channel>
</rss>