蓝叶分享爱奇艺图床接口php代码,首先登陆爱奇艺网页版,随便进入一个影视播放页,使用开发者工具查看当前页面的cookie记录,获取P00001等于后面的值填写到下方代码中,再把视频播放页网址填写到下方代码中,复制代码到php文件中,在同级目录下放一张123.png的图片,运行php文件即可完成图片上传并返回图片地址,使用方法说明有些粗糙,如您懂php代码的话很容易,如若无php代码基础,为避免产生烦恼请勿使用。
<?php header('content-type:application:json;charset=utf8'); $cookie='获取的P00001的值'; $referer='当前视频播放页网址'; $authorcookie=json_decode(Curl('https://sns-comment.iqiyi.com/v3/comment/getAccessToken.action?authcookie='.$cookie, $referer, null, 'get'), true); $imgpath=dirname(__FILE__).'/123.png'; $data = array( 'file'=>new CURLFile($imgpath), 'business_type'=>'image', 'share_type'=>'public', 'auth_token'=>$cookie, 'access_token'=>$authorcookie['data']['access_token'], 'file_type'=>'jpg' ); $jsondat=Curl('https://secupload.iqiyi.com/common_upload', $referer, $data, 'post'); echo $jsondat; function Curl($url, $referer, $data, $type){ $curl = curl_init(); if($type=='post'){ $headers = array( "Accept-Language: zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7", "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537.36", "Host: secupload.iqiyi.com", "Origin: https://www.iqiyi.com", "sec-ch-ua-platform: Windows", "Sec-Fetch-Dest: empty", "Sec-Fetch-Mode: cors", "Sec-Fetch-Site: same-site" ); }else{ $headers = array( "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537.36" ); } curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($curl, CURLOPT_HTTPHEADER,$headers); curl_setopt($curl, CURLOPT_REFERER, $referer); if($type=='post'){ curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $data); } curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); $response = curl_exec($curl); curl_close($curl); return $response; }
免责声明:
本页网址:点击复制分享给朋友吧!
本站分享的一切内容资源如若没有备注,均为蓝叶原创,如需转载请注明出处;如有侵权请与我们联系处理。敬请谅解!