• Php, как проверить на слово в поиске?

    @Wol_fi
    php, js, mysql, highload
    $sourceStream = fopen("/path/to/source.txt", "r");
    $yesFileStream = fopen("/path/to/yes_keys.txt", "w");
    $noFileStream = fopen("/path/to/no_keys.txt", "w");
    if ($sourceStream && $yesFileStream && $noFileStream) {
        while (($buffer = fgets($sourceStream, 4096)) !== false) {
            $key = trim($buffer);
            $data = file_get_contents('http://mydomain.com/search.php?k=' . urlencode($key));
            if (strpos($data, 'yes') !== false) {
                fwrite($yesFileStream, $key . PHP_EOL);
            } else {
                fwrite($noFileStream, $key . PHP_EOL);
            }
        }
        fclose($sourceStream);
        fclose($yesFileStream);
        fclose($noFileStream);
    }

    примерно так
    Ответ написан
    1 комментарий