{"id":23,"date":"2021-11-19T16:26:36","date_gmt":"2021-11-19T08:26:36","guid":{"rendered":"http:\/\/pkant.com\/?p=23"},"modified":"2021-11-19T16:26:56","modified_gmt":"2021-11-19T08:26:56","slug":"%e7%83%ad%e5%b0%94%e5%b8%8c%e8%be%be","status":"publish","type":"post","link":"https:\/\/jwever.cn\/index.php\/2021\/11\/19\/%e7%83%ad%e5%b0%94%e5%b8%8c%e8%be%be\/","title":{"rendered":"POST\u8bf7\u6c42\u65b9\u6cd5\u5c01\u88c5"},"content":{"rendered":"<p>php POST\u8bf7\u6c42\u65b9\u6cd5\u5c01\u88c5<\/p>\n<pre class=\"prettyprint linenums\" ><code class=\"language-php\">    \/**\n     * POST \u8bf7\u6c42\n     * @param string $url\n     * @param array $param\n     * @param boolean $post_file \u662f\u5426\u6587\u4ef6\u4e0a\u4f20\n     * @return string content\n     *\/\n    private function http_post($url, $param, $post_file = false)\n    {\n        $oCurl = curl_init();\n        if (stripos($url, &quot;https:\/\/&quot;) !== FALSE) {\n            curl_setopt($oCurl, CURLOPT_SSL_VERIFYPEER, FALSE);\n            curl_setopt($oCurl, CURLOPT_SSL_VERIFYHOST, false);\n            curl_setopt($oCurl, CURLOPT_SSLVERSION, 1); \/\/CURL_SSLVERSION_TLSv1\n        }\n        if (is_string($param) || $post_file) {\n            $strPOST = $param;\n        } else {\n            $aPOST = array();\n            foreach ($param as $key =&gt; $val) {\n                $aPOST[] = $key . &quot;=&quot; . urlencode($val);\n            }\n            $strPOST = join(&quot;&amp;&quot;, $aPOST);\n        }\n        curl_setopt($oCurl, CURLOPT_URL, $url);\n        curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1);\n        curl_setopt($oCurl, CURLOPT_POST, true);\n        curl_setopt($oCurl, CURLOPT_POSTFIELDS, $strPOST);\n        $sContent = curl_exec($oCurl);\n        $aStatus = curl_getinfo($oCurl);\n        curl_close($oCurl);\n        if (intval($aStatus[&quot;http_code&quot;]) == 200) {\n            return $sContent;\n        } else {\n            return false;\n        }\n    }<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>php POST\u8bf7\u6c42\u65b9\u6cd5\u5c01\u88c5 \/** * POST \u8bf7\u6c42 * @param string $url * @pa [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-23","post","type-post","status-publish","format-standard","hentry","category-houduan"],"_links":{"self":[{"href":"https:\/\/jwever.cn\/index.php\/wp-json\/wp\/v2\/posts\/23","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jwever.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jwever.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jwever.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jwever.cn\/index.php\/wp-json\/wp\/v2\/comments?post=23"}],"version-history":[{"count":2,"href":"https:\/\/jwever.cn\/index.php\/wp-json\/wp\/v2\/posts\/23\/revisions"}],"predecessor-version":[{"id":25,"href":"https:\/\/jwever.cn\/index.php\/wp-json\/wp\/v2\/posts\/23\/revisions\/25"}],"wp:attachment":[{"href":"https:\/\/jwever.cn\/index.php\/wp-json\/wp\/v2\/media?parent=23"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jwever.cn\/index.php\/wp-json\/wp\/v2\/categories?post=23"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jwever.cn\/index.php\/wp-json\/wp\/v2\/tags?post=23"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}