Check if string exists in webpage

how to check if a string exists in a webpage (current webpage)
I have tried this code but it doesn’t work

$contents = file_get_contents("");
$search   ="gtag_report_conversion(url)";

if (strpos($contents, $search) === TRUE) {
    echo "<script>console.log('existant 99');</script>";

Thanks in advance

strpos does not return true/false. It returns an integer.

EDIT: It returns false if it was NOT found. Otherwise it returns an integer.

or false :wink:

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.