string handling
|extract string from offsite
| see demonstration of extract string from offsitethis will get parts of websites on remote servers
just specify words in the remote source to start and end the output
full source of extract string from offsite [ line 1 - 15 ] | download extract string from offsite
| 1 | <?php |
| 2 | // the adress of the remote file to read |
| 3 | $off_site = 'http://fundisom.com/phparadise/snip'; |
| 4 | // you have to backslash certain characters ! |
| 5 | $start = '<title>'; |
| 6 | $end = '</title>'; |
| 7 | $fp = fopen ($off_site, 'r') or die('Unable to open file '.$off_site.' for reading'); |
| 8 | while (!feof ($fp)) |
| 9 | { |
| 10 | $buf = trim(fgets($fp, 4096)); |
| 11 | $cont .= $buf; |
| 12 | } |
| 13 | preg_match("/$start(.*)$end/s",$cont,$match); |
| 14 | echo 'the title of '.$off_site.' is <b>'.$match[1].'</b>'; |
| 15 | ?> |
27 hits by 14 users in the last 30 minutes.