{"id":298,"date":"2010-03-24T17:36:31","date_gmt":"2010-03-24T08:36:31","guid":{"rendered":"http:\/\/yamazon.org\/?p=298"},"modified":"2010-03-24T17:36:31","modified_gmt":"2010-03-24T08:36:31","slug":"php%e3%80%80curl%e3%81%a7post%e9%80%81%e4%bf%a1","status":"publish","type":"post","link":"https:\/\/apr20.net\/?p=298","title":{"rendered":"PHP\u3000cURL\u3067POST\u9001\u4fe1"},"content":{"rendered":"<p>&lt;?php<br \/>\n  $params = array(<br \/>\n    &#8220;login-name&#8221; => &#8216;nakamuraya&#8217;,<br \/>\n    &#8220;login-password&#8221; => &#8216;gerogero&#8217;,<br \/>\n    &#8220;submit&#8221;  => &#8220;\u30ed\u30b0\u30a4\u30f3&#8221;<br \/>\n  );<\/p>\n<p>  $fp = fopen(&#8220;tmp&#8221;, &#8220;w&#8221;);<br \/>\n  $ch = curl_init(&#8220;http:\/\/www.phppro.jp\/members\/login.php&#8221;);<br \/>\n  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);<br \/>\n  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);<br \/>\n  curl_setopt($ch, CURLOPT_COOKIEJAR, &#8220;cookie&#8221;);<br \/>\n  curl_setopt($ch, CURLOPT_POST, TRUE);<br \/>\n  curl_setopt($ch, CURLOPT_POSTFIELDS, $params);<br \/>\n  curl_setopt($ch, CURLOPT_WRITEHEADER, $fp);  $<br \/>\n  output = curl_exec($ch);<br \/>\n  fclose($fp);  curl_close($ch);<br \/>\n  print &#8220;CURL OUTPUT:n{$output}n&#8221;;<\/p>\n<p>  $ch = curl_init(&#8220;http:\/\/www.phppro.jp\/members\/history.php&#8221;);<br \/>\n  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);<br \/>\n  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);<br \/>\n  curl_setopt($ch, CURLOPT_COOKIEJAR, &#8220;cookie&#8221;);<br \/>\n  curl_setopt($ch, CURLOPT_COOKIEFILE, &#8220;tmp&#8221;);<br \/>\n  curl_setopt($ch, CURLOPT_POST, TRUE);<br \/>\n  $output = curl_exec($ch);<br \/>\n  print_r(curl_getinfo($ch));<br \/>\n  curl_close($ch);<br \/>\n  print &#8220;CURL OUTPUT:n{$output}n&#8221;;<\/p>\n<p>?><\/p>\n<p>\u53c2\u7167\u5143 \uff1a http:\/\/itpro.nikkeibp.co.jp\/article\/COLUMN\/20070704\/276685\/<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&lt;?php $params = array( &#8220;login-n&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"class_list":["post-298","post","type-post","status-publish","format-standard","hentry","category-old-blog"],"_links":{"self":[{"href":"https:\/\/apr20.net\/index.php?rest_route=\/wp\/v2\/posts\/298","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/apr20.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/apr20.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/apr20.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/apr20.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=298"}],"version-history":[{"count":0,"href":"https:\/\/apr20.net\/index.php?rest_route=\/wp\/v2\/posts\/298\/revisions"}],"wp:attachment":[{"href":"https:\/\/apr20.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=298"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/apr20.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=298"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/apr20.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=298"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}