social media api

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
gth759k
Forum Commoner
Posts: 76
Joined: Mon Jun 15, 2009 3:04 am

social media api

Post by gth759k »

I'm trying to learn more about how social media api's work. For instance, when you're looking at a news article, sometimes it will have a facebook icon to "share" the article on facebook. If you click on the icon you might get a new popup window and if you look at the url it will be something like:

http://www.facebook.com/sharer.php?u=ht ... volatility

So, I'm assuming this sharer.php script takes the $_GET['u'] value and attaches it to your status update but how does it extract out the title of the article and the body and image, from any source you attach it too. Do all those websites that have the icon have the same xml structure or does the sharer.php script just have to guess? Any help would be appreciated.
User avatar
markusn00b
Forum Contributor
Posts: 298
Joined: Sat Oct 20, 2007 2:16 pm
Location: York, England

Re: social media api

Post by markusn00b »

I assume they use some heuristic that looks for content, typical of an article format. It is an interesting question, though.
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: social media api

Post by Eran »

It's just doing some basic scraping, nothing fancy
Reviresco
Forum Contributor
Posts: 172
Joined: Tue Feb 19, 2008 4:18 pm
Location: Milwaukee

Re: social media api

Post by Reviresco »

Not sure if you're asking how to select the image, title and description to display when the page is shared on Facebook? If so, here are some articles that explain it -- very easy, just add the meta tags to the head of your html page:

http://wiki.developers.facebook.com/ind ... _Meta_Tags

http://opengraphprotocol.org/
gth759k
Forum Commoner
Posts: 76
Joined: Mon Jun 15, 2009 3:04 am

Re: social media api

Post by gth759k »

I noticed on a few other articles I tried, when I clicked the facebook icon and checked the url sometimes it also hat a $_GET['t'] variable corresponding to the title of the page.
Post Reply