i have been received that error recently from a web scrapping php code using html dom parser.
Warning: file_get_contents(https://www.hltv.org/stats/teams/ftu?startDate=2023-03-05&endDate=2023-06-05&maps=de_inferno&side=COUNTER_TERRORIST&rankingFilter=Top30): Failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden in C:UserscaioaDownloadssimplehtmldom_1_9_1simple_html_dom.php on line 82
Call Stack Time Memory Function Location 1 0.0001 364992 {main}( ) ...FTUct.php:0 2 0.0001 373120 file_get_html( $url = https://www.hltv.org/stats/teams/ftu?startDate=2023-03-05&endDate=2023-06-05&maps=de_inferno&side=COUNTER_TERRORIST&rankingFilter=Top30 , $use_include_path = ???, $context = ???, $offset = ???, $maxLen = ???, $lowercase = ???, $forceTagsClosed = ???, $target_charset = ???, $stripRN = ???, $defaultBRText = ???, $defaultSpanText = ??? ) ...FTUct.php:16 3 0.0001 373568 file_get_contents( $filename = https://www.hltv.org/stats/teams/ftu?startDate=2023-03-05&endDate=2023-06-05&maps=de_inferno&side=COUNTER_TERRORIST&rankingFilter=Top30 , $use_include_path = FALSE, $context = NULL, $offset = 0, $length = 600000 ) ...simple_html_dom.php:82
SIMPLE HTML DOM PARSER DOCUMENTATION
$contents = file_get_contents( $url, $use_include_path, $context, $offset, $maxLen LINE 82 ERROR ); // $contents = retrieve_url_contents($url);
if (empty($contents) || strlen($contents) > $maxLen) { $dom->clear(); return false; }
my code
<?php
require( C:UserscaioaDownloadssimplehtmldom_1_9_1simple_html_dom.php );
$url = "https://www.hltv.org/stats/teams/ftu?startDate=2023-03-05&endDate=2023-06-05&maps=de_inferno&side=COUNTER_TERRORIST&rankingFilter=Top30";
#file_get_contents($url,false,null,0,null);
$html = file_get_html( https://www.hltv.org/stats/teams/ftu?startDate=2023-03-05&endDate=2023-06-05&maps=de_inferno&side=COUNTER_TERRORIST&rankingFilter=Top30 );
$n = 0;
foreach($html->find( tbody , 0)->find( tr td.factor-team ) as $data){
$time1 = "Vitality";
$nome = $data->plaintext;
echo $nome;
?>
i has tried change the file_get_content maxLen but doesen t work.