Skip to content

Commit

Permalink
fix for cloudflare 524 timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
dehlirious committed Mar 31, 2023
1 parent d68d5f0 commit dd72700
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion classes/DomDocumentParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public function __construct($url)
'http'=>array('method'=>"GET", 'header'=>"User-Agent: doogleBot/0.1\n")
);
$context = stream_context_create($options);
$getConstants = file_get_contents($url, false, $context);
$getConstants = @file_get_contents($url, false, $context);

$this->doc = new DomDocument('1.0', 'utf-8');
@$this->doc->loadHTML($html . $getConstants);
Expand Down
12 changes: 11 additions & 1 deletion crawl-manual.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,19 @@ function getDetails($url)

}

if($debuggingp){ //Each fitted with @ to supress PHP warnings when the variable doesn't exist.
/* https://github.com/marcialpaulg/Fixing-Cloudflare-Error-524 */
$spacer_size = 12; // increment me until it works
echo str_pad('', (1024 * $spacer_size), "\n");
// send 8kb of new line to browser (default), just make sure that this new line will not affect your code.
// if you have output compression, make sure your data will reach >8KB.

if(ob_get_level()) ob_end_clean();

if(isset($debuggingp)){
if($debuggingp){ //Each fitted with @ to supress PHP warnings when the variable doesn't exist.
echo "<b>URL:</b> ".@$url.", <b>Title:</b> ".@$title.", <b>Description:</b> ".@$description.", <b>keywords:</b> ".@$keywords."<br>"; //DEBUGGING sites
echo "<b>src:</b> <a href=".@$src.">".@$src."</a>, <b>alt:</b> ".@$alt.", <b>title:</b> ".@$title.", <b>url:</b> ".@$url."<br>"; //DEBUGGING images
}
}
}

Expand Down

0 comments on commit dd72700

Please sign in to comment.