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

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.