bringing your vision to life

Matrix Culture

Facebook get current URL, Current Facebook page, get current facebook url

While building a facebook applicaiton that will be utilized across 100's of pages it was found a slight challenge to grab the current url dynamically...

First try:

function curPageURL() {
 $pageURL = 'http';
 if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
 $pageURL .= "://";
 if ($_SERVER["SERVER_PORT"] != "80") {
  $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
 } else {
  $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
 }
 return $pageURL;
}
 
$currenturl = curPageURL();

A simple curl call was tried, however the server where the .php was was called not the facebook url

 

What worked:

<?php

$pageid = $_REQUEST['fb_sig_page_id'];

//grabs the current page id then use the current page id with the graph api

Retrieve Facebook fan page id, Facebook app page id php

So This helpful entry hopefully helps some one trying to dynamically retrieve some facebook id for the the fan page the user is currently looking at.

I searched the Facebook documentation and referred consistently to this but didn't straight explain how to get this dynamic variable in php.

So it's quite simple really once you find it but you can see it here:  This will allow you to retrieve the current page's id... no need to curl it and parse the id, it's right here.

<?php

print $_REQUEST['fb_sig_page_id'];

?>

 

We used this is the implementation and delivery of the juno wallet facebook fanpage application which can be seen here:

http://www.facebook.com/pages/Apollo-Matrix-LLC/120845234620618?v=app_13...

 

hope this helps, and as always apollo matrix can help with all of your face book apps...

Apollo Matrix Culture, Development Culture

Matrix: A is a group of people united by a belief system which is defined by the Matrix members. At Apollo Matrix, what we believe is that everyone has a vision, and that we are the best team to bring it to life.


Utilizing any of the latest technologies we can create anything you can imagine, for any platform you desire. Here at Apollo Matrix we take a slightly different approach to our clients. What we hope for is a relationship that lasts far beyond one single project. To that end, we will do everything in our power to keep you coming back to us for your development solutions.


We think of our clients as partners, with your success being our success...and we like to succeed. So, lets us introduce our's culture to you:

Syndicate content