View Single Post
  #1 (permalink)  
Old 05-12-2008, 03:48 AM
phpforfun's Avatar   
phpforfun phpforfun is offline
Programming God
 
Join Date: Feb 2008
Posts: 794
Last Blog:
Programming "Just a ...
Credits: 102
Rep Power: 9
phpforfun will become famous soon enoughphpforfun will become famous soon enough
Default

This one should be easy to explain.

When I type in http:/ /google.com (without the space), here, on code call, it comes out as Google..

whats the code to take the name of the page, not the URL?

after some thought, im gonna take a shot in the dark.

you use the readfile command to read the source of the file
then use preg match to get whatever is between the <title></title> tags
then echo it?

Tried these
PHP Code:
<?
$viewsource
="http://google.com";

        
$lines file("$viewsource");

        foreach (
$lines as $line_num => $line) {
         if (
stristr($lines,"<title>")){
            
$title2=strip_tags($lines);
            Echo 
$title2;
         }

        }



?>
PHP Code:
<?
      $file
=fopen("http://google.com",r);
    
$read fgets($file,255); 
         if (
stristr($file,"<title>")){
            
$title=strip_tags($read);
         }
      
fclose($file);

Echo 
$title;
?>
No luck, am I close?
__________________

Last edited by John; 05-12-2008 at 12:53 PM.
Reply With Quote

Sponsored Links