{"id":813,"date":"2011-12-16T00:29:33","date_gmt":"2011-12-15T16:29:33","guid":{"rendered":"http:\/\/www.awaysoft.com\/taor\/?p=813"},"modified":"2011-12-16T00:29:33","modified_gmt":"2011-12-15T16:29:33","slug":"php%e6%a8%a1%e6%8b%9fpost","status":"publish","type":"post","link":"https:\/\/actom.me\/blog\/php%e6%a8%a1%e6%8b%9fpost.html","title":{"rendered":"php\u6a21\u62dfpost"},"content":{"rendered":"<p>\u4eca\u5929\u505a\u4e2a\u4e1c\u897f\u9700\u8981\u7528\u5230\u8fd9\u4e2a\uff0c\u987a\u4fbf\u8bb0\u5f55\u4e0b\u3002<\/p>\n<p>\u4f7f\u7528\u65b9\u6cd5\uff1aaway_post(\u7f51\u5740,\u6570\u7ec4);<\/p>\n<p>&lt;?php<br \/>\n\/* awaysoft.com<br \/>\ntom<br \/>\n*\/<br \/>\nfunction array_to_string($arrays){<br \/>\n$values = array();<br \/>\nforeach($arrays as $key=&gt;$value)<br \/>\n$values[]= &#8220;$key=&#8221;.urlencode($value);<\/p>\n<p>return implode(&#8220;&amp;&#8221;, $values);<br \/>\n}<\/p>\n<p>function away_post($url, $arrays){<br \/>\n$posts = array_to_string($arrays);<br \/>\n$context = array(<br \/>\n&#8216;http&#8217;=&gt;array(<br \/>\n&#8216;method&#8217; =&gt; &#8216;POST&#8217;,<br \/>\n&#8216;header&#8217; =&gt; &#8220;Content-type: application\/x-www-form-urlencoded\\r\\n&#8221;.<br \/>\n&#8220;User-Agent: Away User synchronization Client\\r\\n&#8221;.<br \/>\n&#8220;Content-length: &#8220;.(strlen($posts)),<br \/>\n&#8216;content&#8217; =&gt; $posts<br \/>\n)<br \/>\n);<br \/>\n$stream_context = stream_context_create($context);<br \/>\nreturn file_get_contents($url, FALSE, $stream_context);<br \/>\n}\uff1a<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4eca\u5929\u505a\u4e2a\u4e1c\u897f\u9700\u8981\u7528\u5230\u8fd9\u4e2a\uff0c\u987a\u4fbf\u8bb0\u5f55\u4e0b\u3002 \u4f7f\u7528\u65b9\u6cd5\uff1aaway_post(\u7f51\u5740,\u6570\u7ec4 &#8230; <a class=\"more-link\" href=\"https:\/\/actom.me\/blog\/php%e6%a8%a1%e6%8b%9fpost.html\">Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"_links":{"self":[{"href":"https:\/\/actom.me\/blog\/wp-json\/wp\/v2\/posts\/813"}],"collection":[{"href":"https:\/\/actom.me\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/actom.me\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/actom.me\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/actom.me\/blog\/wp-json\/wp\/v2\/comments?post=813"}],"version-history":[{"count":1,"href":"https:\/\/actom.me\/blog\/wp-json\/wp\/v2\/posts\/813\/revisions"}],"predecessor-version":[{"id":814,"href":"https:\/\/actom.me\/blog\/wp-json\/wp\/v2\/posts\/813\/revisions\/814"}],"wp:attachment":[{"href":"https:\/\/actom.me\/blog\/wp-json\/wp\/v2\/media?parent=813"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/actom.me\/blog\/wp-json\/wp\/v2\/categories?post=813"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/actom.me\/blog\/wp-json\/wp\/v2\/tags?post=813"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}