< php $ title_regex = ' ( . + ) %
< \\ /Title> % i' ;
2 Usate file_get_contents per archiviare il contenuto della pagina HTML in una variabile . Per esempio :
$ page = file_get_contents ( " http://example.com/index.html " ) ;
3
analizzare il codice HTML utilizzando il normale espressione. Passare un array vuoto per PHP per popolare con l'intera partita come il primo elemento di un array e il testo tra i tag titolo come il secondo elemento . Per esempio :
$ match = array ( ) ;/* intera partita sarà in $ matches [ 0 ] e il testo del titolo sarà a $ matches [ 1 ] * /if ( preg_match ( $ title_regex , $ page , $ matches ) && isset ($ match [1]) ) $ title = $ matches [ 1 ] ; title altro $ = " Non trovato" ; ? >
< br >