I'm looking for a php or other language script that can get the current page link (address bar)which could be inserted into the facebook LIKE code : <iframe src="http://www.facebook.com/plugins/like.php?href=[B][COLOR="Red"]http://example.com[/COLOR][/B]%2Fpage%2Fto%2Flike&layout=standard&show_faces=true&width=450&action=like&colorscheme=light&height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe> Code (markup): Because its an iframe, I'm lost on how to do this ? EDIT: I found it: <iframe src="http://www.facebook.com/widgets/like.php?href=<?= "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; ?>" scrolling="no" frameborder="0" style="border:none; width: 450px; height: 80px;"></iframe> PHP: Well the above does get the full url, however facebook will only store the domain_name and the ?first=variable
I understand what your saying, but the js code on facebook rewrites the url so it doesn't matter what way you send it in, ie: view the iframe source code here on dp's facebook like button My solution was to write a .htaccess redirect
if your url has an & in it, it will be processed as another variable instead of part of the URL iirc, that's why I said urlencode
The snippet to get the URL is <?php $url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; echo $url; ?> PHP:
<iframe src="http://www.facebook.com/widgets/like.php?href=<?=urlencode("http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']); ?>" scrolling="no" frameborder="0" style="border:none; width: 450px; height: 80px;"></iframe> PHP:
this is the exactly what you are looking about. i have tested this and it worked well. Thanks @K1llswitch
Hi K1llswitch, I need a standard size button not the ( width: 450px; height: 80px; ). It will be a standard size with like count 1, 2, 3, 4.... Kindly suggest.. Thanks
like button uses the id of the facebook page. For G+ you can +1'd any page, on facebook you can like only the facebook page
This is not working for me, I can see that the page extended so the code is red, but no button appear.