Oppure

Loading
12/02/13 11:35
LukeMilan
Ciao a tutti ragazzi. Ho bisogno di uno script PHP che legga un file esterno (.html) in particolare dove è presente una stringa ( ad esempio <title> ) e quindi ne restituisce la stringa completa( <title>Titolo</title> ).

Grazie mille.:k:
Ultima modifica effettuata da LukeMilan 12/02/13 11:36
aaa
12/02/13 14:38
dmr
Si ma qual è il tuo problema? Hai almeno provato a farlo??
aaa
12/02/13 14:48
LukeMilan
Non ho nessun problema :-|

Ho semplicemente chiesto come fare.
aaa
12/02/13 15:50
pierotofy
Usa file_get_contents per leggere il file, dopodiche' puoi usare una Regex per estrapolare la porzione di testo che ti serve.

php.net/manual/en/…

php.net/manual/en/…
Il mio blog: piero.dev
12/02/13 17:48
LukeMilan
Ma posso farlo nelle pagine html di altri siti web? -NO

Quindi la tua soluzione non va bene :(
-------------------------------------------------------
Riscrivo la domanda in modo più semplice:
Dato un url ($url) come faccio a ottenere in output la descrizione($description) e il titolo($title)?
Così va meglio :k:
Ultima modifica effettuata da LukeMilan 12/02/13 17:57
aaa
12/02/13 18:05
pierotofy
Postato originariamente da LukeMilan:

Ma posso farlo nelle pagine html di altri siti web? -NO


E invece si. Non hai nemmeno letto i links che ti ho dato. :pat:
Il mio blog: piero.dev
12/02/13 18:21
LukeMilan
Ma perché se scrivo:
<?php
$homepage = file_get_contents('http://www.google.com/');
echo $homepage;
?>


Non mi restituisce niente? D:
aaa
12/02/13 19:07
LukeMilan
Comunque ho provato con questo:
<?php
// Assuming the above tags are at example.com
$tags = get_meta_tags('example.com/');

// Notice how the keys are all lowercase now, and
// how . was replaced by _ in the key.
echo $tags['author']; // name
echo $tags['keywords']; // php documentation
echo $tags['description']; // a php manual
echo $tags['geo_position']; // 49.33;-86.59
?>
Ma non funziona!
aaa