{"id":101657,"date":"2021-09-04T17:24:36","date_gmt":"2021-09-04T09:24:36","guid":{"rendered":"https:\/\/www.keaglegz.com\/?p=101657"},"modified":"2021-09-04T17:24:36","modified_gmt":"2021-09-04T09:24:36","slug":"%e6%90%9c%e7%8b%97%e5%9b%be%e5%ba%8a%e6%96%87%e4%bb%b6%e4%b8%8a%e4%bc%a0%e6%8e%a5%e5%8f%a3%e6%ba%90%e7%a0%81","status":"publish","type":"post","link":"https:\/\/www.dongwubaike.cn\/fanhao\/101657.html","title":{"rendered":"\u641c\u72d7\u56fe\u5e8a\u6587\u4ef6\u4e0a\u4f20\u63a5\u53e3\u6e90\u7801"},"content":{"rendered":"\n<pre>&lt;?php  header('Access-Control-Allow-Origin:*');  header('Content-type:application\/json; charset=utf-8');  error_reporting(0);  $allowedExts = array(\"gif\", \"jpeg\", \"jpg\", \"png\");  $temp = explode(\".\", $_FILES[\"file\"][\"name\"]);  $extension = end($temp);  \/\/\u6587\u4ef6\u683c\u5f0f\u53ca\u5927\u5c0f\u505a\u4e00\u4e0b\u9650\u5236\u9650\u5236  if ((($_FILES[\"file\"][\"type\"] == \"image\/gif\")          || ($_FILES[\"file\"][\"type\"] == \"image\/jpeg\")          || ($_FILES[\"file\"][\"type\"] == \"image\/jpg\")          || ($_FILES[\"file\"][\"type\"] == \"image\/pjpeg\")          || ($_FILES[\"file\"][\"type\"] == \"image\/x-png\")          || ($_FILES[\"file\"][\"type\"] == \"image\/png\"))      && ($_FILES[\"file\"][\"size\"] &lt; 10*1024*1024)      && in_array($extension, $allowedExts)) {      $ImageCachePath='images\/sougou\/';\/\/\u4e34\u65f6\u7f13\u5b58\u8def\u5f84      \/\/\u5224\u65ad\u76ee\u5f55\u5b58\u5728\u5426\uff0c\u5b58\u5728\u7ed9\u51fa\u63d0\u793a\uff0c\u4e0d\u5b58\u5728\u5219\u521b\u5efa\u76ee\u5f55      if (!is_dir($ImageCachePath)){          $res = mkdir($ImageCachePath, 0777, true);      }      \/\/\u56e0\u4e3a\u4e0d\u652f\u6301\u76f4\u63a5\u4f7f\u7528\u4e34\u65f6\u6587\u4ef6\u4e0a\u4f20 \u6240\u4ee5\u8981\u5148\u4fdd\u5b58\u4e00\u4e0b      move_uploaded_file($_FILES[\"file\"][\"tmp_name\"], $ImageCachePath . $_FILES[\"file\"][\"name\"]);      \/\/\u6587\u4ef6\u50a8\u5b58\u4f4d\u7f6e      $files = $ImageCachePath . $_FILES[\"file\"][\"name\"];      $post_data = [          \"pic_path\"=&gtnew CURLFile(realpath($files))      ];      $str=urldecode(Curl_POST(\"http:\/\/pic.sogou.com\/ris_upload\",$post_data));      unlink($files); \/\/\u4f7f\u7528\u5b8c\u9500\u6bc1\u4e00\u4e0b\u6587\u4ef6      $imgurl =  str_replace(\"http\",\"https\",GetBetween($str,\".com\/ris?query=\",\"&oname=\"));      if ($imgurl==1 || $imgurl==\"\"){          exit(json_encode([              \"code\"=&gt-1,              \"msg\"=&gt\"\u4e0a\u4f20\u9519\u8bef\"          ],JSON_UNESCAPED_UNICODE));      }else{          exit(json_encode([              \"code\"=&gt1,              \"imgurl\"=&gt$imgurl          ],JSON_UNESCAPED_UNICODE));      }      }else {      error(\"\u975e\u6cd5\u7684\u6587\u4ef6\u683c\u5f0f\");  }  function GetBetween($content, $start, $end)  {      $r = explode($start, $content);      if (isset($r[1])) {          $r = explode($end, $r[1]);          return $r[0];      }      return '';  }  function randIp()  {      return mt_rand(0, 255) . '.' . mt_rand(0, 255) . '.' . mt_rand(0, 255) . '.' . mt_rand(0, 255);  }  function Curl_POST($url,$post_data){      $header=[          'X-FORWARDED-FOR:'.randIp(),          'CLIENT-IP:'.randIp()      ];      $ch = curl_init();      curl_setopt($ch, CURLOPT_URL, $url);      curl_setopt($ch, CURLOPT_NOBODY, false);      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);      curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, false);      curl_setopt($ch, CURLOPT_TIMEOUT, 30);      curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);      curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);      curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);      curl_setopt($ch, CURLOPT_AUTOREFERER, true);      curl_setopt($ch, CURLOPT_USERAGENT, \"Mozilla\/5.0 (Windows NT 10.0; WOW64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/65.0.3325.181 Safari\/537.36\");   \/\/ \u4f2a\u9020ua      curl_setopt($ch, CURLOPT_HTTPHEADER,$header);      curl_setopt($ch, CURLOPT_ENCODING, '');      curl_setopt($ch, CURLOPT_POST, true);      curl_setopt($ch, CURLOPT_POSTFIELDS,$post_data);      curl_exec($ch);      $data = curl_getinfo($ch,CURLINFO_EFFECTIVE_URL);      return $data;  }<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>&lt;?php header(&#8216;Access-Control-Allow-Origin:*&#8217;); header(&#8216;Content-type:application\/json; charset=utf-8&#8217;); error_reportin [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-101657","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/www.dongwubaike.cn\/fanhao\/wp-json\/wp\/v2\/posts\/101657","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dongwubaike.cn\/fanhao\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dongwubaike.cn\/fanhao\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dongwubaike.cn\/fanhao\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dongwubaike.cn\/fanhao\/wp-json\/wp\/v2\/comments?post=101657"}],"version-history":[{"count":0,"href":"https:\/\/www.dongwubaike.cn\/fanhao\/wp-json\/wp\/v2\/posts\/101657\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.dongwubaike.cn\/fanhao\/wp-json\/wp\/v2\/media?parent=101657"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dongwubaike.cn\/fanhao\/wp-json\/wp\/v2\/categories?post=101657"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dongwubaike.cn\/fanhao\/wp-json\/wp\/v2\/tags?post=101657"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}