stefaniv Posted April 29, 2012 Share Posted April 29, 2012 Hi ! It's me again... So there is this php code: $url = "http://google.com";$file = file($url);$file = implode("",$file);if(preg_match("/<title>(.+)<\/title>/i",$file,$m))print "<b>$m[1]";elseprint "No Title"; It works perfectly for every site except for http://vbox7.com ( Example: http://vbox7.com/play:7a98330863). Any ideas ? Link to comment Share on other sites More sharing options...
Ingolme Posted April 29, 2012 Share Posted April 29, 2012 That's a greedy rule. If another </title> tag is found it will take up all the text until it finds it. This might work better: /<title>([^<]+)<\/title>/i What happens when you try your current code anyways? Link to comment Share on other sites More sharing options...
stefaniv Posted April 30, 2012 Author Share Posted April 30, 2012 Gives the result "No title" Link to comment Share on other sites More sharing options...
justsomeguy Posted April 30, 2012 Share Posted April 30, 2012 Have you printed out the variable $file to see what you're actually grabbing from the other server? That page redirects 3 or 4 times. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.