自己吧文件随便上传php空间,同目录下新建一个ck.txt存放ck,用宝塔的计划任务或者其他什么的监控这个php文件就行

  1. <?php
  2. $ck=file_get_contents(“ck.txt”);//ck自己新建个ck.txt文件放同目录下
  3. $url=”https://api.m.jd.com/client.action?functionId=cakebaker_pk_getCakeBomb”;
  4. $data=”functionId=cakebaker_pk_getCakeBomb&body={}&client=wh5&clientVersion=1.0.0″;
  5. $header = array(
  6.     “Content-Type: application/x-www-form-urlencoded”,
  7.     “Content-Length: 74”,
  8.     “Connection: keep-alive”,
  9.     “User-Agent:  jdapp;”,
  10.     “Accept-Language: zh-cn”,
  11.     “Accept: application/json, text/plain, */*”
  12. );
  13. function jdza($url, $header, $data,$cookie){
  14.     $ch = curl_init();
  15.     curl_setopt($ch, CURLOPT_URL, $url);
  16.     curl_setopt($ch, CURLOPT_POST, true);
  17.     curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);
  18.     curl_setopt($ch, CURLOPT_POSTFIELDS,$data);
  19.     curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
  20.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  21.     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  22.     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  23.     curl_setopt($ch,CURLOPT_COOKIE,$cookie);
  24.     $re = curl_exec($ch);
  25.     curl_close($ch);
  26.     //return json_decode($re,true)[‘data’][‘tip’]
  27.     return json_decode($re,true)[‘data’][‘result’][‘tip’];
  28. }
  29. $tmp=jdza($url,$header,$data,$ck);//炸蛋糕返回值结果
  30. echo $tmp;
  31. //这里可以填写你的server酱之类的
  32. file_get_contents(“server酱通知地址”);