{"id":3131,"date":"2026-02-21T12:43:59","date_gmt":"2026-02-21T04:43:59","guid":{"rendered":"https:\/\/blog.nonot.cn\/?p=3131"},"modified":"2026-02-21T12:43:59","modified_gmt":"2026-02-21T04:43:59","slug":"php-curl%e6%a8%a1%e6%8b%9fpost%e8%af%b7%e6%b1%82%e5%b0%8f%e5%ae%9e%e4%be%8b","status":"publish","type":"post","link":"https:\/\/blog.nonot.cn\/index.php\/2026\/02\/21\/php-curl%e6%a8%a1%e6%8b%9fpost%e8%af%b7%e6%b1%82%e5%b0%8f%e5%ae%9e%e4%be%8b\/","title":{"rendered":"php curl\u6a21\u62dfpost\u8bf7\u6c42\u5c0f\u5b9e\u4f8b"},"content":{"rendered":"<p>\u672c\u673a\uff1a<\/p>\n<p>&lt;?php<br \/>\n$uri = &#8220;http:\/\/www.a.com\/test.php&#8221;;\/\/\u8fd9\u91cc\u6362\u6210\u4f60\u670d\u52a1\u5668\u7684\u5730\u5740<br \/>\n\/\/ \u53c2\u6570\u6570\u7ec4<br \/>\n$data = array (<br \/>\n&#8216;name&#8217; =&gt; &#8216;tanteng&#8217;<br \/>\n\/\/ &#8216;password&#8217; =&gt; &#8216;password&#8217;<br \/>\n);<\/p>\n<p>$ch = curl_init ();<br \/>\n\/\/ print_r($ch);<br \/>\ncurl_setopt ( $ch, CURLOPT_URL, $uri );<br \/>\ncurl_setopt ( $ch, CURLOPT_POST, 1 );<br \/>\ncurl_setopt ( $ch, CURLOPT_HEADER, 0 );<br \/>\ncurl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );<br \/>\ncurl_setopt ( $ch, CURLOPT_POSTFIELDS, $data );<br \/>\n$return = curl_exec ( $ch );<br \/>\ncurl_close ( $ch );<\/p>\n<p>print_r($return);<\/p>\n<p>&nbsp;<\/p>\n<p>\u8fdc\u7a0b\u670d\u52a1\u5668\uff1a<\/p>\n<p>&lt;?php<br \/>\nif(isset($_POST[&#8216;name&#8217;])){<br \/>\nif(!empty($_POST[&#8216;name&#8217;])){<br \/>\necho &#8216;\u60a8\u597d\uff0c&#8217;,$_POST[&#8216;name&#8217;].&#8217;\uff01&#8217;;<br \/>\n}<br \/>\n}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u673a\uff1a &lt;?php $uri = &#8220;htt&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3131","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/posts\/3131","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/comments?post=3131"}],"version-history":[{"count":1,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/posts\/3131\/revisions"}],"predecessor-version":[{"id":3132,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/posts\/3131\/revisions\/3132"}],"wp:attachment":[{"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/media?parent=3131"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/categories?post=3131"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/tags?post=3131"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}