English 中文(简体)
how to fix html dom parser forbidden error?
原标题:

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.

问题回答

暂无回答




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签