<?php header("Content-type:text/html;charset=utf-8"); //jkch.net if (class_exists('CURLFile')) { // php 5.5 $post['file'] = new \CURLFile(realpath($_FILES['Filedata']['tmp_name'])); } else { $post['file'] = '@'.realpath($_FILES['Filedata']['tmp_name']); } $rel = get_curl('https://search.jd.com/image?op=upload',$post); preg_match('/callback(?:\(\")(.*)(?:\"\))/i',$rel,$matches); if (!$matches[1]) { exit('图片上传失败!'); } $arr = array( 'code' => 200, 'imgurl'=> 'https://img'.rand(10,14).'.360buyimg.com/uba/'.$matches[1] ); $jsondata = json_encode($arr); $obj = json_decode($jsondata); $imgurl = $obj->imgurl; echo "小桃子工作室"."<br/>"; echo "图片上传成功"."<br/>"; echo "图片地址:".$imgurl."<br/>"; echo "<img src=\"".$imgurl."\"/>"."<br/>"; echo "json:".json_encode($arr); exit(); function get_curl($url, $post=0, $referer=0, $cookie=0, $header=0, $ua=0, $nobaody=0){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); $httpheader[] = "Accept:application/json"; $httpheader[] = "Accept-Encoding:gzip,deflate,sdch"; $httpheader[] = "Accept-Language:zh-CN,zh;q=0.8"; $httpheader[] = "Connection:close"; curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader); if ($post) { curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); } if ($header) { curl_setopt($ch, CURLOPT_HEADER, true); } if ($cookie) { curl_setopt($ch, CURLOPT_COOKIE, $cookie); } if($referer){ if($referer==1){ curl_setopt($ch, CURLOPT_REFERER, 'http://m.qzone.com/infocenter?g_f='); }else{ curl_setopt($ch, CURLOPT_REFERER, $referer); } } if ($ua) { curl_setopt($ch, CURLOPT_USERAGENT, $ua); } else { curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Linux; U; Android 4.0.4; es-mx; HTC_One_X Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0"); } if ($nobaody) { curl_setopt($ch, CURLOPT_NOBODY, 1); } curl_setopt($ch, CURLOPT_TIMEOUT, 3); curl_setopt($ch, CURLOPT_ENCODING, "gzip"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $ret = curl_exec($ch); curl_close($ch); return $ret; }
分享两个版本的网站运行时间代码 PHP版本 显示为 本站运行:3年9月10天 <?php date_default_timezone_set('Asia/Shanghai')...
代码分享,这个是网站提供的三种会员,每个ip每天只能获取三次 所以换个ip就可以无限查看了 获取页面如下(图省事,就简单的输出了下) 思路很好,思源补注释,仅供学习参考 <?php...
分享一个思源常用的给emlog加字体图标的方法 起源,,几天前写一个律师模板在手机端有个导航,需要加字体图标如图 进入正题 给导航加字体图标 1.首先,先引入字体图标(如模板自带,请省略)...
目标接口:https://h5.pipix.com/bds/webapi/item/detail/?item_id= id根据301跳转后截取item/ 和?中间的值 curl模拟设备获取数据 然...
<?php // 实例1 /** * @start time */ function proStartTime() { global $startTime; $mtime1...
一、校验数字的表达式 1 数字:^[0-9]*$2 n位的数字:^\d{n}$3 至少n位的数字:^\d{n,}$4 m-n位的数字:^\d{m,n}$5 零和非零开头的数字:^(0|[1-9][...