{"id":5818,"date":"2019-10-22T11:36:17","date_gmt":"2019-10-22T02:36:17","guid":{"rendered":"https:\/\/nsme.red\/wp\/?p=5818"},"modified":"2025-06-23T09:33:02","modified_gmt":"2025-06-23T00:33:02","slug":"%e3%83%97%e3%83%ad%e3%82%b0%e3%83%a9%e3%83%a0%e3%81%8b%e3%82%89%e3%83%87%e3%83%bc%e3%82%bf%e9%80%81%e4%bf%a1","status":"publish","type":"post","link":"https:\/\/core.nsme.net\/notes\/php\/5818\/","title":{"rendered":"\u30d7\u30ed\u30b0\u30e9\u30e0\u304b\u3089\u30c7\u30fc\u30bf\u9001\u4fe1"},"content":{"rendered":"\n<p>&nbsp;&nbsp;curl\u5229\u7528\u3059\u308b\u65b9\u304c\u671b\u307e\u3057\u3044<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">curl\u5229\u7528\u3059\u308b<\/h1>\n\n\n\n<p>$kintai = &#8216;http:\/\/nsme.red\/test\/reception.php&#8217;;&nbsp;&nbsp; &nbsp;&nbsp;<br>$data =array(<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&#8216;stafid&#8217; =&gt;&#8217;1234&#8242;,<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&#8216;date&#8217;=&gt;&#8217;2018\/10\/14&#8217;,<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&#8216;start&#8217;=&gt;&#8217;08:30&#8217;,<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&#8216;end&#8217;=&gt;&#8217;17:30&#8217;,<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&#8216;rest&#8217;=&gt;&#8217;60&#8217;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;);<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;\/\/cURL\u30bb\u30c3\u30b7\u30e7\u30f3\u3092\u521d\u671f\u5316\u3059\u308b<br>$ch = curl_init();<br>\/\/URL\u3068\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u6307\u5b9a\u3059\u308b<br>curl_setopt($ch, CURLOPT_URL, $kintai);<br>curl_setopt($ch, CURLOPT_POST, true); \/\/POST\u304c\u6709\u52b9<br>curl_setopt($ch, CURLOPT_POSTFIELDS, $data);<br>&nbsp;<br>\/\/URL\u306e\u60c5\u5831\u3092\u53d6\u5f97\u3059\u308b<br>$res = &nbsp;curl_exec($ch);<br>&nbsp;<br>\/\/\u7d50\u679c\u3092\u8868\u793a\u3059\u308b<br>var_dump($res);<br>&nbsp;<br>\/\/\u30bb\u30c3\u30b7\u30e7\u30f3\u3092\u7d42\u4e86\u3059\u308b<br>curl_close($ch);<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">file_get_contents\u3092\u5229\u7528<\/h1>\n\n\n\n<p>$kintai = &#8216;http:\/\/nsme.red\/test\/reception.php&#8217;;\u00a0\u00a0 \u00a0\u00a0<br>$data =array(<br>\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0&#8216;stafid&#8217; =>&#8217;1234&#8242;,<br>\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0&#8216;date&#8217;=>&#8217;2018\/10\/14&#8217;,<br>\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0&#8216;start&#8217;=>&#8217;08:30&#8217;,<br>\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0&#8216;end&#8217;=>&#8217;17:30&#8217;,<br>\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0&#8216;rest&#8217;=>&#8217;60&#8217;<br>\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0);<br>\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0<br>\u00a0 \u00a0 \u00a0 \u00a0 $data = http_build_query($data, &#8220;&#8221;, &#8220;&amp;&#8221;);<br>\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0$options =array(<br>\u00a0 \u00a0 \u00a0 \u00a0 &#8216;http&#8217; => array(<br>\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0&#8216;method&#8217;=> &#8216;POST&#8217;,<br>\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0&#8216;header&#8217;=> &#8216;Content-Type: application\/x-www-form-urlencoded&#8217;,<br>\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0&#8216;content&#8217; => $data<br>\u00a0 \u00a0 \u00a0 \u00a0 )<br>\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0);<br>\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\/\/ \u30b9\u30c8\u30ea\u30fc\u30e0\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u306e\u4f5c\u6210<br>\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0$context = stream_context_create($options);<br>\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\/\/ POST\u9001\u4fe1<br>\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0$contents = file_get_contents(&#8216;http:\/\/core.nsme.net\/test\/reception.php&#8217;, false, $context);<br>\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\/\/ reception.php \u306e\u30ec\u30b9\u30dd\u30f3\u30b9\u3092\u8868\u793a<br>\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0echo $contents;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp;&nbsp;curl\u5229\u7528\u3059\u308b\u65b9\u304c\u671b\u307e\u3057\u3044 curl\u5229\u7528\u3059\u308b $kintai = &#8216;http:\/\/nsme.red\/test\/reception.php&#8217;;&nbsp;&nbsp; &#038;n [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[9],"tags":[18,19],"class_list":["post-5818","post","type-post","status-publish","format-standard","hentry","category-php","tag-curl","tag-file_get_contents"],"acf":[],"_links":{"self":[{"href":"https:\/\/core.nsme.net\/notes\/wp-json\/wp\/v2\/posts\/5818","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/core.nsme.net\/notes\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/core.nsme.net\/notes\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/core.nsme.net\/notes\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/core.nsme.net\/notes\/wp-json\/wp\/v2\/comments?post=5818"}],"version-history":[{"count":2,"href":"https:\/\/core.nsme.net\/notes\/wp-json\/wp\/v2\/posts\/5818\/revisions"}],"predecessor-version":[{"id":6288,"href":"https:\/\/core.nsme.net\/notes\/wp-json\/wp\/v2\/posts\/5818\/revisions\/6288"}],"wp:attachment":[{"href":"https:\/\/core.nsme.net\/notes\/wp-json\/wp\/v2\/media?parent=5818"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/core.nsme.net\/notes\/wp-json\/wp\/v2\/categories?post=5818"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/core.nsme.net\/notes\/wp-json\/wp\/v2\/tags?post=5818"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}