Jump to content

Adding Social Networking Bookmarks To Footer..


PHPNewbie55

Recommended Posts

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!!

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.