{"id":676,"date":"2018-11-08T16:30:15","date_gmt":"2018-11-08T07:30:15","guid":{"rendered":"https:\/\/blog.tkouen.mydns.jp\/wordpress\/?p=676"},"modified":"2018-11-08T16:30:15","modified_gmt":"2018-11-08T07:30:15","slug":"%e8%a6%9a%e6%9b%b8php%e3%81%a7pop%e6%8e%a5%e7%b6%9a%e3%81%97%e3%81%a6%e5%86%85%e5%ae%b9%e3%82%92%e5%8f%96%e5%be%97%e3%83%a1%e3%83%a2","status":"publish","type":"post","link":"https:\/\/devlog.nb3.jp\/wordpress\/676","title":{"rendered":"[\u899a\u66f8]PHP\u3067POP\u63a5\u7d9a\u3057\u3066\u5185\u5bb9\u3092\u53d6\u5f97[\u30e1\u30e2]"},"content":{"rendered":"<p>\u304a\u4e45\u3057\u3076\u308a\u3067\u3059\u3002<\/p>\n<p>\u3068\u308a\u3042\u3048\u305a\u3001php\u3067pop\u63a5\u7d9a\u3057\u3066\u30e1\u30fc\u30eb\u306e\u5185\u5bb9\u3092\u53d6\u5f97\u3059\u308b\u3093\u3054\uff01<\/p>\n<p><!--more--><\/p>\n<pre class=\"brush: php; gutter: true\">&lt;?php\r\n$host = &quot;ssl:\/\/[\u30db\u30b9\u30c8\u540d]&quot;;\r\n$port = &quot;[\u30dd\u30fc\u30c8\u756a\u53f7]&quot;;\r\n$user = &quot;[\u30e6\u30fc\u30b6\u30fc\u540d]&quot;;\r\n$pass = &quot;[\u30d1\u30b9\u30ef\u30fc\u30c9]&quot;;\r\n\/\/ \u63a5\u7d9a\r\n$con = fsockopen( $host, $port, $err, $errno );\r\n\r\n\/\/ \u8a8d\u8a3c\u30e6\u30fc\u30b6\u30fc\r\nfputs($con, &quot;USER {$user}\\r\\n&quot;);\r\n$buf = fgets($con, 512);\r\n\r\n\/\/ \u8a8d\u8a3c\u30d1\u30b9\u30ef\u30fc\u30c9\r\nfputs($con, &quot;PASS {$pass}\\r\\n&quot;);\r\n$buf = fgets($con, 512);\r\n\r\n\/\/ \u30e1\u30fc\u30eb\u30e1\u30c3\u30bb\u30fc\u30b8\u306e\u6570\u3068\u30b5\u30a4\u30ba\u3092\u5fdc\u7b54\u3059\u308b\r\nfputs($con, &quot;STAT\\r\\n&quot;);\r\n$buf = fgets($con, 512);\r\n$tmp = explode(&quot; &quot;,$buf);\r\nif ($tmp[1] == &quot;Logged&quot;){\r\n    $buf = fgets($con, 512);\r\n    $tmp = explode(&quot; &quot;,$buf);\r\n}\r\nif ($tmp[1] == 0){\r\n\u00a0 \u00a0 \/\/ \u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u306a\u3044\u5834\u5408\u306f\u3001\u63a5\u7d9a\u3092\u9589\u3058\u308b\r\n    fputs($con, &quot;QUIT\\r\\n&quot;);\r\n    $buf = fgets($con, 512);\r\n    exit;\r\n}\r\n\r\n\/\/ \u6307\u5b9a\u3055\u308c\u305f\u30e1\u30c3\u30bb\u30fc\u30b8\u756a\u53f7\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u5168\u4f53\u3092\u8868\u793a\u3059\u308b\r\nfputs($con, &quot;RETR 1\\r\\n&quot;); \/\/ \u4eca\u56de\u306f1\u756a\u306e\u3092\u53d6\u5f97\r\n$buf = fgets($con, 512);\r\n$data=&#039;&#039;\uff1b\r\nwhile ( !feof($con) ) {\r\n    $meta_data = stream_get_meta_data($con);\r\n    if($meta_data[&quot;timed_out&quot;]) break;\r\n\u00a0   $line = fgets($con);\r\n    if($line === false || preg_match(&quot;\/^\\.\\r\\n\/&quot;, $line)) break;\r\n    $line = preg_replace(&quot;\/^\\.\\.\/&quot;, &quot;.&quot;, $line);\r\n    $data .= $line;\r\n}\r\n\/\/ \u63a5\u7d9a\u3092\u9589\u3058\u308b\r\nfputs($con, &quot;QUIT\\r\\n&quot;);\r\n$buf = fgets($con, 512);\r\n<\/pre>\n<p>$data\u306f\u30e1\u30fc\u30eb\u306e\u30d8\u30c3\u30c0\u30fc\u90e8\u5206\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u306e\u3067\u30d8\u30c3\u30c0\u30fc\u90e8\u5206\u3068\u30dc\u30c7\u30a3\u30fc\u90e8\u5206\u3092\u5206\u96e2\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u3002<br \/>\n\u3067\u3001\u30dc\u30c7\u30a3\u30fc\u306e\u90e8\u5206\u304c\u30d8\u30c3\u30c0\u30fc\u90e8\u5206\u3067\u66f8\u304b\u308c\u3066\u3044\u308bContent-Type\u306echarset\u306e\u6587\u5b57\u30b3\u30fc\u30c9\u306b\u306a\u3063\u3066\u3044\u308b\u306e\u3067\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u304cUTF-\uff18\u306e\u5834\u5408\u306f\u3001\u6271\u3044\u3084\u3059\u3044\u3088\u3046\u306bUTF-8\u3078\u3057\u3066\u3042\u3052\u308b\u3068\u3044\u3044\u306e\u304b\u306a\u3002<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u304a\u4e45\u3057\u3076\u308a\u3067\u3059\u3002 \u3068\u308a\u3042\u3048\u305a\u3001php\u3067pop\u63a5\u7d9a\u3057\u3066\u30e1\u30fc\u30eb\u306e\u5185\u5bb9\u3092\u53d6\u5f97\u3059\u308b\u3093\u3054\uff01<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,9],"tags":[20,151,152,109],"class_list":["post-676","post","type-post","status-publish","format-standard","hentry","category-php","category-program","tag-php-2","tag-pop","tag-152","tag-109"],"_links":{"self":[{"href":"https:\/\/devlog.nb3.jp\/wordpress\/wp-json\/wp\/v2\/posts\/676","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devlog.nb3.jp\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devlog.nb3.jp\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devlog.nb3.jp\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/devlog.nb3.jp\/wordpress\/wp-json\/wp\/v2\/comments?post=676"}],"version-history":[{"count":1,"href":"https:\/\/devlog.nb3.jp\/wordpress\/wp-json\/wp\/v2\/posts\/676\/revisions"}],"predecessor-version":[{"id":677,"href":"https:\/\/devlog.nb3.jp\/wordpress\/wp-json\/wp\/v2\/posts\/676\/revisions\/677"}],"wp:attachment":[{"href":"https:\/\/devlog.nb3.jp\/wordpress\/wp-json\/wp\/v2\/media?parent=676"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devlog.nb3.jp\/wordpress\/wp-json\/wp\/v2\/categories?post=676"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devlog.nb3.jp\/wordpress\/wp-json\/wp\/v2\/tags?post=676"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}