PHPNewbie55 Posted April 21, 2008 Share Posted April 21, 2008 I started a thread >> http://www.phpfreaks.com/forums/index.php/topic,193524.0.html And that topic was quickly solved... And since I was tinkering around with that, I thought it would be a good idea to create a little script that I could put in my footer (or anyones footer for that matter) that would create links to some of the social bookmarking/networking sites... These links require an url and title of the link to be bookmarked. Example: http://digg.com/submit?phase=2&url=#####&title=##### The problem is.. I want the user to be able to bookmark the current page.. This code seems to loop for awhile before it returns zero results... <?php $url = "http://".$_SERVER['HTTP_HOST']."".$_SERVER['PHP_SELF'].""; $data = file_get_contents("".$url.""); preg_match('/<title>(.*?)<\/title>/',$data, $matches); $title = "".str_replace("<title>", "", str_replace("</title>", "", $matches['0'])).""; print "<a href=\"http://digg.com/submit?phase=2&url=".$url."&title=".$title."\">Digg</a>"; ?> My question is... Is there a way to return the TITLE of the current page correctly.. without choking..?? Thank you in advance!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.