Hey Guys,

Before I start working on this I figured I would see if any of you knew the best place for information on building a Digg style function. I am not talking about the Digg button, I am talking about the "Submit a New Link" function that diggs through the URL and gets the Title, Body and ties the title to the URL.

Does anyone know any good tutorials? I was going to use pligg, but I want more customization so I code it myself. : )

Any help appreciated!

Recommended Answers

All 4 Replies

Hmm, you could use the file_get_contents() function on the URL that is submitted to your website, then use a regular expression (you can obviously use other functions too) to find the things you want.

Shouldn't be that difficult, since you're only searching for a <title> and <body> tag

Ok well that kinda makes sense...I will look into this. If anyone has an example or tutorial url it would be appreciated : )

A simple script like this might already work:

$url="http://www.something.com";
$source=file_get_contents($url);
preg_match("<title>[a-zA-Z0-9<>/]{1,}</title>",$source,$value);
$title=$value[0];

Obviously you might need to tweak things a bit but this should give you something to start with.

commented: Great Help : ) +1

Thank you sooo much that helped : )

A simple script like this might already work:

$url="http://www.something.com";
$source=file_get_contents($url);
preg_match("<title>[a-zA-Z0-9<>/]{1,}</title>",$source,$value);
$title=$value[0];

Obviously you might need to tweak things a bit but this should give you something to start with.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.