php 1.0 KB

123456789101112131415161718192021222324252627282930
  1. <?php
  2. $postfields = 'captcha=123';
  3. $cookies = "regimcode_162100bbs=123";
  4. $web1 = 'http://103.45.68.47:6800/gy/gy-fabu.php';
  5. $result = curl($web1, $cookies, $postfields);
  6. preg_match('/>p3p¶Ë¿Ú£º<a href="(.*?)"/', $result, $matches);
  7. $web2 = $matches[1];
  8. $result = curl($web2);
  9. echo $result;
  10. function curl($url, $cookies = '' ,$postfields = ''){
  11. $ua = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36';
  12. $ch = curl_init();
  13. curl_setopt($ch, CURLOPT_URL, $url);
  14. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  15. if(!empty($postfields) && !empty($cookies))
  16. {
  17. curl_setopt($ch, CURLOPT_POST, 1);
  18. curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
  19. curl_setopt($ch, CURLOPT_COOKIE, $cookies);
  20. }else{
  21. curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
  22. }
  23. curl_setopt($ch, CURLOPT_USERAGENT, $ua);
  24. curl_setopt($ch, CURLOPT_TIMEOUT, 10);
  25. $result = curl_exec($ch);
  26. curl_close($ch);
  27. return $result;
  28. }
  29. ?>