Jump to content

php help


barryflood22

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.