A
A
angden2021-08-20 11:57:16
PHP
angden, 2021-08-20 11:57:16

When the donor site switched to ssl, the parser stopped working, how to fix it?

There was a standings parser from a sports site

<?php
  $data = join("", file("http://www.vhlru.ru/"));
    $a = ' <td class="table__align-left">';
    $b = '</tr>';
    if (
      preg_match_all (
      '#'.preg_quote($a).'(.+?)'.preg_quote($b).'#is', $data, $arr_table
      )
    )
  $fh = fopen("table.txt", "w+");
    
    for ($i=0;$i<count($arr_table[1]);$i++) {
      $string = trim($arr_table[1][$i]);
      $string = str_replace("\n","",$string);
      $string = strip_tags(str_replace('    <td>','|', $string));
      $string = str_replace(" |","|",$string);
      fwrite($fh, $string."\n");
    }
    
  fclose($fh);
?>


The site vhlru.ru connected ssl, the parser began to give an error

Warning: file(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in */table/parser.php on line 5

Warning: file(): Failed to enable crypto in //table/parser.php on line 5

Warning: file(https://www.vhlru.ru/): failed to open stream: operation failed in */table/parser.php on line 5

Warning: join(): Invalid arguments passed in */table/parser.php on line 5

Warning: fclose() expects parameter 1 to be resource, null given in */table/parser.php on line 28


tell me how to fix it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
inFureal, 2021-08-20
@inFureal

It is written directly - an error of check of the certificate. So something was tricky with the ssl connection

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question