dyg.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. $DATA = curl('https://vip.lianfaka.com/vip/?url='.$_REQUEST['url']);
  2. preg_match('/source src="(.*?)"/',$DATA,$url);
  3. if (empty($url[1])) {
  4. $add['code'] = 404;
  5. $add['msg'] = '解析失败';
  6. $add['from'] = 'Q:2579949378';
  7. $add['name'] = '蓝莓';
  8. } else {
  9. $add['code'] = 200;
  10. $add['msg'] = '解析成功';
  11. $add['from'] = 'Q:2579949378';
  12. $add['name'] = '蓝莓';
  13. $add['url'] = $url[1];
  14. }
  15. echo json_encode($add,456);
  16. function curl($url, $cookie = '')
  17. {
  18. // 初始化cURL\n
  19. $curl = curl_init();// 设置网址
  20. curl_setopt($curl, CURLOPT_URL, $url);
  21. // 设置UA
  22. $header[] = 'Referer: https://www.dy6g.com';
  23. $header[] = 'User-Agent: Mozilla/5.0 (Linux; Android 6.0.1; OPPO R9s Plus Build/MMB29M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/55.0.2883.91 Mobile Safari/537.36';
  24. // 设置请求头
  25. curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
  26. // 设置POST数据
  27. // 允许执行的最长秒数 超时时间
  28. curl_setopt($curl, CURLOPT_TIMEOUT, 30);
  29. // 过SSL验证证书
  30. curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
  31. curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
  32. // 将头部作为数据流输出
  33. curl_setopt($curl, CURLOPT_HEADER, false);
  34. // 设置以变量形式存储返回数据
  35. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  36. // 请求并存储数据
  37. $return = curl_exec($curl);
  38. // 分割头部和身体
  39. if (curl_getinfo($curl, CURLINFO_HTTP_CODE) == '200') {
  40. $return_header_size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
  41. $return_header = substr($return, 0, $return_header_size);
  42. $return_data = substr($return, $return_header_size);
  43. }
  44. // 关闭cURL
  45. curl_close($curl);
  46. // 返回数据
  47. return $return;
  48. }