{"id":339288,"date":"2021-02-14T00:54:19","date_gmt":"2021-02-13T16:54:19","guid":{"rendered":"http:\/\/4563.org\/?p=339288"},"modified":"2021-02-14T00:54:19","modified_gmt":"2021-02-13T16:54:19","slug":"mjj%e4%b8%93%e7%94%a8server%e9%85%b1-%e4%bc%81%e4%b8%9a%e5%be%ae%e4%bf%a1%e9%80%9a%e9%81%93php%e7%89%88","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=339288","title":{"rendered":"MJJ\u4e13\u7528server\u9171 \u4f01\u4e1a\u5fae\u4fe1\u901a\u9053PHP\u7248"},"content":{"rendered":"\n<p>  \t\t\t\t\t<strong>\u7ea2A<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3>MJJ\u4e13\u7528server\u9171 \u4f01\u4e1a\u5fae\u4fe1\u901a\u9053PHP\u7248<\/h3>\n<p>  \t\t \u672c\u5e16\u6700\u540e\u7531 \u7ea2A \u4e8e 2021-2-10 13:41 \u7f16\u8f91 <\/p>\n<p> \u76f8\u4fe1\u5927\u5bb6\u90fd\u7528\u8fc7\u6216\u8005\u542c\u8bf4\u8fc7server\u9171<br \/>  \u56e0\u4e3a\u5fae\u4fe1\u53d1\u5e03\u516c\u544a\u5c06\u57284\u6708\u5e95\u4e0b\u7ebf\u6a21\u677f\u6d88\u606f\uff0cServer\u9171\u5f00\u53d1\u4e86\u4ee5\u4f01\u4e1a\u5fae\u4fe1\u4e3a\u4e3b\u7684\u591a\u901a\u9053\u65b0\u7248\u3002\u65e7\u7248\u5c06\u57284\u6708\u540e\u4e0b\u7ebf\u3002<\/p>\n<p>  \u8fd9\u4e2a\u4f01\u4e1a\u5fae\u4fe1\u662f\u968f\u4fbf\u90fd\u53ef\u4ee5\u6ce8\u518c\u7684\uff0c\u4e14\u7a0d\u5fae\u64cd\u4f5c\u540e\u5fae\u4fe1app\u7aef\u4e5f\u53ef\u4ee5\u6536\u5230\u63a8\u9001\u3002<br \/>  \u800c\u4e14server\u9171\u7684\u670d\u52a1\u662f\u6709\u4e00\u4e9b\u9650\u5236\u7684\uff0c\u90a3\u6211\u4eec\u5c31\u4e0d\u5982\u81ea\u5df1\u6574\u4e00\u4e2a\u63a8\u9001\u901a\u9053\u3002\u6ca1\u6709\u6bcf\u5206\u949f\u6700\u591a1\u6761\uff0c\u514d\u8d39\u7248\u6bcf\u59295\u6761\u7684\u9650\u5236\u3002<\/p>\n<p>  \u7b2c\u4e00\u6b65\u5462\u8981\u5148\u6ce8\u518c\u4f01\u4e1a\u5fae\u4fe1\uff0c\u6211\u4eec\u76f4\u63a5\u770bserver\u9171\u7684\u6559\u7a0b\uff0c\u8bb0\u4e0b\u6559\u7a0b\u91cc\u7684\u5e94\u7528ID( agentid )\uff0c\u5e94\u7528Secret( secret )\uff0c\u4f01\u4e1aID\u3002<br \/>  \u6211\u628a\u6559\u7a0b\u590d\u5236\u5230\u77f3\u58a8\u4e86\uff0cserver\u9171\u7684\u8fd8\u9700\u8981\u767b\u5f55\u624d\u80fd\u770b\u3002https:\/\/shimo.im\/docs\/38dpjtwWtRRVQ6Wy<\/p>\n<p>  \u4ee3\u7801\u6bd4\u8f83\u7b80\u964b\uff0c\u4ec5\u4ec5\u662f\u80fd\u7528\u7684\u7a0b\u5ea6\uff0c\u5e0c\u671b\u5927\u4f6c\u4eec\u53ef\u4ee5\u5f00\u53d1\u51fa\u66f4\u52a0\u5b8c\u5584\u7684\u7248\u672c<br \/>  \u6bd4\u5982\u4f01\u4e1a\u5fae\u4fe1\u652f\u6301\u5f88\u591a\u79cd\u6d88\u606f\uff0c\u6211\u53ea\u5199\u4e86\u5361\u7247\u6d88\u606f\u4e00\u79cd<br \/>  \u4f01\u4e1a\u5fae\u4fe1\u7684api\u6587\u6863\uff1ahttps:\/\/work.weixin.qq.com\/api\/doc\/90000\/90135\/90236<\/p>\n<p>  \u8bbf\u95ee\u65f6\u5e26\u4e0a\u53c2\u6570\u5c31\u884c\u5566\uff0cget post\u90fd\u53ef\u4ee5\u3002<br \/>  \u5982 http:\/\/example.com\/server.php?corpid=xxx&amp;corpsecret=xxx&amp;agentid=xxx&amp;title=title&amp;description=desc&amp;url=url<\/p>\n<p>  \u6548\u679c\u56fe<\/p>\n<p>  \u6700\u540e\u662f\u4ee3\u7801<br \/>  &lt;?php<\/p>\n<p>  $corpid = $_REQUEST[&#8216;corpid&#8217;]; \/\/\u4f01\u4e1aid<br \/>  $corpsecret = $_REQUEST[&#8216;corpsecret&#8217;]; \/\/\u5e94\u7528secret<br \/>  $agentid = $_REQUEST[&#8216;agentid&#8217;]; \/\/\u5e94\u7528id<\/p>\n<p>  \/\/\u5982\u679c\u5c31\u81ea\u5df1\u7528\uff0c\u53ef\u4ee5\u628a\u53c2\u6570\u5199\u5230\u8fd9\u91cc\u3002<br \/>  \/\/$corpid = &#8221;;<br \/>  \/\/$corpsecret = &#8221;;<br \/>  \/\/$agentid = ;<\/p>\n<p>  $title = $_REQUEST[&#8216;title&#8217;]; \/\/\u6d88\u606ftitle<br \/>  $description = $_REQUEST[&#8216;description&#8217;]; \/\/\u6d88\u606f\u5185\u5bb9<br \/>  $description = str_replace(PHP_EOL, &#8216;&lt;br&gt;&#8217;, $description);<br \/>  $url = $_REQUEST[&#8216;url&#8217;]; \/\/\u6d88\u606f\u8df3\u8f6curl<\/p>\n<p>  if(!$corpid or !$corpsecret or !$agentid){<br \/>  &nbsp; &nbsp; exit(&quot;canshu buquan&quot;);<br \/>  }<\/p>\n<p>  \/\/\u83b7\u53d6access_token<br \/>  $response = CurlGet(&quot;https:\/\/qyapi.weixin.qq.com\/cgi-bin\/gettoken?corpid=$corpid&amp;corpsecret=$corpsecret&quot;,&quot;&quot;,&quot;&quot;);<\/p>\n<p>  $access_token = json_decode($response)-&gt;access_token;<br \/>  if(!$access_token){<br \/>  &nbsp; &nbsp; exit(&quot;canshu cuowu&quot;);<br \/>  }else{<\/p>\n<p>  &nbsp; &nbsp; $json = &#8216;{&quot;touser&quot;:&quot;@all&quot;,&quot;msgtype&quot;:&quot;textcard&quot;,&quot;agentid&quot;:&quot;&quot;,&quot;textcard&quot;:{&quot;title&quot;:&quot;&quot;,&quot;description&quot;:&quot;&quot;,&quot;url&quot;:&quot;&quot;,&quot;btntxt&quot;:&quot;\u66f4\u591a&quot;},&quot;safe&quot;:1,&quot;enable_id_trans&quot;:0,&quot;enable_duplicate_check&quot;:0}&#8217;;<br \/>  &nbsp; &nbsp; $json = json_decode($json);<\/p>\n<p>  &nbsp; &nbsp; $json-&gt;agentid = $agentid;<br \/>  &nbsp; &nbsp; $json-&gt;textcard-&gt;title = $title ? $title : &#8216;\u65e0\u6807\u9898&#8217;;<br \/>  &nbsp; &nbsp; $json-&gt;textcard-&gt;description = $description ? $description : &#8216;\u65e0\u5185\u5bb9&#8217;;<br \/>  &nbsp; &nbsp; <br \/>  &nbsp; &nbsp; $json-&gt;textcard-&gt;url = $url ? $url : &#8216;URL&#8217;;<\/p>\n<p>  &nbsp; &nbsp; echo CurlPost(&quot;https:\/\/qyapi.weixin.qq.com\/cgi-bin\/message\/send?access_token=$access_token&quot;,&quot;&quot;, json_encode($json));<br \/>  }<\/p>\n<p>  function CurlGet($url,$cookies = &quot;&quot;,$UserAgent = &quot;&quot;)<br \/>  {<br \/>  &nbsp; &nbsp; $curl = curl_init();<br \/>  &nbsp; &nbsp; curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; curl_setopt($curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 ); <br \/>  &nbsp; &nbsp; curl_setopt($curl, CURLOPT_URL, $url);&nbsp; &nbsp;<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; curl_setopt($curl, CURLOPT_REFERER, &#8221;);<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; curl_setopt($curl, CURLOPT_COOKIE, $cookies);<br \/>  &nbsp; &nbsp; curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);<br \/>  &nbsp; &nbsp; if ($UserAgent != &quot;&quot;) {<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;curl_setopt($curl, CURLOPT_USERAGENT, $UserAgent);<br \/>  &nbsp; &nbsp; }<br \/>  &nbsp; &nbsp; curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);<br \/>  &nbsp; &nbsp; curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);<br \/>  &nbsp; &nbsp; curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);<br \/>  &nbsp; &nbsp; $response = curl_exec($curl);<br \/>  &nbsp; &nbsp; curl_close($curl);<br \/>  &nbsp; &nbsp; return $response;<br \/>  }<\/p>\n<p>  function CurlPost($url, $cookies=&quot;&quot;, $post_data=&quot;&quot;, $headers=array(), $refer=&quot;&quot;, $UserAgent = &#8221;)<br \/>  {<\/p>\n<p>  &nbsp; &nbsp; $curl = curl_init();<br \/>  &nbsp; &nbsp; curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); <br \/>  &nbsp; &nbsp; &nbsp; &nbsp; curl_setopt($curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 ); <br \/>  &nbsp; &nbsp; curl_setopt($curl, CURLOPT_URL, $url);&nbsp; &nbsp;<br \/>  &nbsp; &nbsp; curl_setopt($curl, CURLOPT_USERAGENT, $UserAgent); <br \/>  &nbsp; &nbsp; &nbsp; &nbsp; curl_setopt($curl, CURLOPT_COOKIE, $cookies);<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);<br \/>  &nbsp; &nbsp; if ($refer != &#8221;) {<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;curl_setopt($curl, CURLOPT_REFERER, $refer);<br \/>  &nbsp; &nbsp; }<br \/>  &nbsp; &nbsp; curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);<br \/>  &nbsp; &nbsp; curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);<br \/>  &nbsp; &nbsp; curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);<br \/>  &nbsp; &nbsp; curl_setopt($curl, CURLOPT_POST, 1);<br \/>  &nbsp; &nbsp; curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data);<br \/>  &nbsp; &nbsp; $response = curl_exec($curl);<br \/>  &nbsp; &nbsp; curl_close($curl);<br \/>  &nbsp; &nbsp; return $response;<br \/>  }\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>\u4f3c\u6bdb\u975e\u6bdb<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u7ea2A \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2021-2-10 14:16<br \/>  \u662f\u561b&#8230;\u6211\u8fd8\u662f\u7279\u610f\u641c\u7d22\u8fc7\u6ca1\u6709\u76f8\u5173\u5e16\u5b50\u518d\u53d1\u7684\u5440\uff0c\u770b\u6765\u662f\u6211\u6ca1\u6709\u641c\u5230<\/p>\n<p> \u697c\u4e3b\u8fd9\u4e2a\u633a\u597d\u7684\u3002\u6211\u4e5f\u627e\u8fc7\uff0c\u6ca1\u627e\u5230\u3002\u3002\u5012\u662f\u6709\u4eba\u505a\u4e86\u4e2aAPI\u6a21\u4effSERVER\u9171\u3002\u8ba9\u522b\u4eba\u7528\u5b83\u7684API\u3002\u3002\u3002<\/p>\n<p>  MJJ\u81ea\u5efa\u624d\u662f\u738b\u9053\u3002\u3002\u3002\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>\u7ea2A<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\tnetsky \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2021-2-10 13:34<br \/>  \u914d\u7f6e\u4e86\u600e\u4e48\u7528\uff0c\u76f4\u63a5\u8bbf\u95ee\u63d0\u793acanshu buquan<\/p>\n<p> \u8bbf\u95ee\u7684\u65f6\u5019\u5e26\u4e0a\u53c2\u6570<\/p>\n<p>  corpid \/\/\u4f01\u4e1aid<br \/>  corpsecret \/\/\u5e94\u7528secret<br \/>  agentid\/\/\u5e94\u7528id<\/p>\n<p>  title \/\/\u6d88\u606ftitle<br \/>  description \/\/\u6d88\u606f\u5185\u5bb9<br \/>  url \/\/\u6d88\u606f\u8df3\u8f6curl  \t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>h20<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u8fd9\u662f\u5e72\u561b\u7528\u7684\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>\u76ae\u5361\u4e18<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\th20 \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2021-2-10 12:18<br \/>  \u8fd9\u662f\u5e72\u561b\u7528\u7684<\/p>\n<p> \u63a8\u9001\u6d88\u606f\u5427\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>JtrD<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u597d\u3002\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>\u7ea2A<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\th20 \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2021-2-10 12:18<br \/>  \u8fd9\u662f\u5e72\u561b\u7528\u7684<\/p>\n<p> \u63a8\u9001\u901a\u77e5\u6d88\u606f\u7528\u7684\u5440\uff0c\u53ef\u4ee5\u76f4\u63a5\u63a8\u9001\u5230\u5fae\u4fe1\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>\u4f3c\u6bdb\u975e\u6bdb<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u4e0d\u9519~~~\u7528\u4e86\u8fd9\u4e2a\u5c31\u4e0d\u7528SERVER\u9171\u4e86\u3002\u642d\u5728\u81ea\u5df1\u4e3b\u673a\u5c31i\u884c\u4e86\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>zhongziso<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\tmark\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>silence<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u7ed1\u5b9a\uff0c\u7814\u7a76\u4e00\u4e0b\u600e\u4e48\u7528\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>\u55f7\u55f7<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u6218\u7565\u6027\u9a6c\u514b<\/p>\n<p>  \u200b\u200b\u200b\u200b\u200b\u200b\u200b\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>suichang<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u4e0d\u9519\t\t\t  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7ea2A \u5927\u4f6c\u6709\u8bdd\u8bf4 : MJJ\u4e13\u7528s&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/339288"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=339288"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/339288\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=339288"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=339288"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=339288"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}