fork download
  1. <?php
  2. function fetchData($url, $headers) {
  3. $ch = curl_init();
  4.  
  5. curl_setopt($ch, CURLOPT_URL, $url);
  6. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  7. curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  8. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // Opcional: Desactiva la verificación SSL
  9.  
  10. $response = curl_exec($ch);
  11.  
  12. if (curl_errno($ch)) {
  13. echo "cURL Error: " . curl_error($ch);
  14. return false;
  15. }
  16.  
  17. curl_close($ch);
  18. return $response;
  19. }
  20.  
  21. function applyRegexReplacements($input) {
  22. $patterns = [
  23. '/^/' => "<table><remove ",
  24. '/$/' => "></table>",
  25. '/¬~TR÷(.*?)¬/' => "><tr><td>$1</td><remove ",
  26. '/TN÷(.*?)¬TI÷/' => "><td>$1</td><remove ",
  27. '/¬TM÷(.*?)¬TW÷(.*?)¬TWR÷.*?¬TDR÷(.*?)¬TL÷(.*?)¬TLR.*?¬TG÷(.*?):(.*?)¬.*?TP÷(.*?)¬/'
  28. => "><td>$1</td><td>$2</td><td>$3</td><td>$4</td><td>$5</td><td>$6</td><td>$7</td></tr><remove "
  29. ];
  30.  
  31. return preg_replace(array_keys($patterns), array_values($patterns), $input);
  32. }
  33.  
  34. // Definir la URL y los headers
  35. $url = "https://g...content-available-to-author-only...e.ninja/202/x/feed/to_IqH6hAEK_YyM2A7oh_1";
  36. $headers = ["X-Fsign: SW9D1eZo"];
  37.  
  38. // Obtener los datos de la URL
  39. $data = fetchData($url, $headers);
  40.  
  41. if ($data !== false) {
  42. // Aplicar los reemplazos con regex
  43. $processedData = applyRegexReplacements($data);
  44.  
  45. // Mostrar el resultado
  46. echo $processedData;
  47. }
  48. ?>
  49.  
Success #stdin #stdout 0.04s 25872KB
stdin
Standard input is empty
stdout
cURL Error: Could not resolve host: global.flashscore.ninja