Jump to content

Recommended Posts

This might help you.

 

 

You will first need a form to in the main page.

 

 

index.html

<form method="post" action="check.php">
URL: <input type="text" value="" name="url"/></br>
Text to find: <input type="text" value="" name="ttf"/>
</form>

 

 

check.php

<?php


// get data from form
$url = $_POST["url"];
$ttf = $_POST["ttf"];


// check if page exist
if (file_exists($url)) {

// file open and read
$fh = fopen($url, 'r');

// find text in file
$pos = strpos($fh, $ttf);

// check if text if found in source code is false
if (pos === false) {

// echo that the text cannot be found
echo "Url doesnt not contain" .  $ttf ;
}

// else echo that it is successful
else {
echo "Successful";
}
}

// if page cannot be found, echo fail
else {
echo "Url doesnt not contain" .  $ttf ;
}
?>

 

if it works for you, you may want to donate to me for helping? you should earn quite a fair bit of amount for doing it for your client.

Link to comment
https://forums.phpfreaks.com/topic/240477-php-help/#findComment-1235254
Share on other sites

<?php
$url = $_POST['url'];
$term = $_POST['term'];
?>

<form method="post" action="">
URL: <input type="text" value="<?php echo $url;?>" name="url"/></br>
Search Term: <input type="text" value="<?php echo $term;?>" name="term"/>
<input type="submit" value="Search"/>
</form>

<?php
if(isset($_POST['url']) && !empty($_POST['url']) && isset($_POST['term']) && !empty($_POST['term'])){

$content = file_get_contents($url);

if (preg_match("/$term/i", $content)) {
    echo $term ." exists.";
} else {
    echo $term . " not found.";
}
} else {
    echo "Insert value.";
}

?>

Link to comment
https://forums.phpfreaks.com/topic/240477-php-help/#findComment-1235274
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.