» »

Preverjanje, če je spletna stran enaka

Preverjanje, če je spletna stran enaka

d4vid ::

Pozdravljeni!

Zanima me, kako bi lahko v PHPju ali v nečem, kar deluje pod linuxom v CLI, preveril, če je spletna stran še vedno ista.
Na disku bi imel shranjeno spletno stran v HTML formatu (prvotno), potem pa bi server na pol ure preverjal, če je stran na oddaljenem strežniku še vedno enaka, če ni, se sproži neka skripta (npr. aplay ...).

Bi šlo preprosto s md5 hashom?

Lep pozdrav!
Main PC: HP Z240 | i5-7400 | 32 GB ram
Homelab: HP DL380g9 | Xeon E5-2680 | 192 GB ram

Hayabusa ::

Bojan xxxx ::

misliš nekaj na to temo:

wget -O - https://slo-tech.com/ | md5sum -

Primer:
jest@gentoo ~/Zacasno $ wget -O - https://slo-tech.com/ | md5sum -
--2013-02-27 12:35:35-- https://slo-tech.com/
Resolving slo-tech.com... 91.236.1.130, 2001:67c:2730:1::2
Connecting to slo-tech.com|91.236.1.130|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: `STDOUT'

2013-02-27 12:35:35 (505 KB/s) - written to stdout [52494]

0f37fc1053b74273b33a398228ccfad6 -


... in če se hash spremeni, pač rečeš naj pošlje mail ali kaj podobnega.

d4vid ::

Ja, sam zdaj sem ugotovil, da se stran spreminja... Zato me zanima, če se da s PHPjem pogledati če na tej strani obstaja določeno besedilo, v nasprotnem primeru pa se zažene neka skripta?
Main PC: HP Z240 | i5-7400 | 32 GB ram
Homelab: HP DL380g9 | Xeon E5-2680 | 192 GB ram

Bojan xxxx ::

Za PHP nisem pravi naslov, v Pythonu pa bi šlo nekako po tem principu

a = "Jest sem en cel web page, in imam tudi vsaj en heading XXXX"
b = "XXXX"

if b in a:
    pass
else:
    print("Mene ni vec tukaj")

keworkian ::

$contents = file_get_contents("url_do_strani");

if (stripos($contents,  "tvojstavk")===FALSE) {
 //nared neki
}
Obscenities in B-Flat

_Dormage_ ::

Hayabusa ::

Zgodovina sprememb…

  • spremenilo: Hayabusa ()

Hayabusa ::

peta:
http://stackoverflow.com/questions/1125...

šesta:
http://www.mostlymaths.net/2010/01/cron...


sedma:
http://honza.brucek.cz/2009/02/webpage-...


osma:
http://pastebin.com/BHqmLsXg
function webch(){

f1=/tmp/.`mcookie` #File to save webpage in the first time
f2=/tmp/.`mcookie` #File to save webpage in to compare to first download
url=$1 #Passing the first argument to the variable url
wget -q -O $f1 $url #Fetching the page for the first time
tmp=0 #Setting tmp to 1
if [ -z $2 ]; #Checking if time to wait has been supplied (in seconds)
then
time=30 #Default if not supplied
else
time=$2 #Setting time to what was passed
fi

while [ $tmp -eq 0 ] ; do
sleep $time #Waiting before fetching the page
wget -q -O $f2 $url #Fetching page
cmp $f1 $f2 #Checking first fetch vs last. cmp exits with 0 if files are the same, 1 if they are different
tmp=$? #Setting what cmp exited with to tmp
done
rm $f1 $f2 #removing files that are nolonger needed

if [ $tmp -gt 1 ] #Checks if cmp gave an error
then
echo "An error occured"
exit 127
fi

if [ -z $3 ]; #Checks if an action has been supplied
then
echo "It changed!" #Default output if no action has been supplied
echo -en "\007" #Beeps once to notify that a change has occured
else
${@:3} #Completes supplied command(s)
fi
return 0
}

Zgodovina sprememb…

  • spremenilo: Hayabusa ()


Vredno ogleda ...

TemaSporočilaOglediZadnje sporočilo
TemaSporočilaOglediZadnje sporočilo
»

Različen PING - kako realno testirati povezavo v svet?

Oddelek: Omrežja in internet
172992 (2305) hojnikb
»

Kako narediti request z "\" v URL-ju

Oddelek: Programiranje
172192 (1467) Horejšio
»

[Opera] Unable to complete secure transaction

Oddelek: Slo-Tech
242845 (1589) pegasus
»

Težave - internet

Oddelek: Omrežja in internet
301609 (1347) megy
»

Asus WL500gP, dd-wrt, printer and disk sharing

Oddelek: Omrežja in internet
96839 (3243) coyotee

Več podobnih tem