Topic-icon Dynamic URL when posting to facebook

Active Subscriptions:

None
14 years 3 months ago #20224 by danielo
Hi ,

I'm using the following code to post to facebook when users land on a specific page:

require_once JPATH_ROOT.DS.'components'.DS.'com_jfbconnect'.DS.'libraries'.DS.'facebook.php';
$jfbcLibrary = JFBConnectFacebookLibrary::getInstance();
$post = 'I just joined my school';
$post = 'URL of current page';
if ($jfbcLibrary->getUserId()) // Check if there is a Facebook user logged in
$jfbcLibrary->setFacebookMessage($post);

How would I echo $_SERVER or something similar to show a link to the page the post was sent from?

Thanks for you help
The topic has been locked.
Active Subscriptions:

None
14 years 3 months ago #20235 by mtk

danielo wrote: Hi ,

I'm using the following code to post to facebook when users land on a specific page:

require_once JPATH_ROOT.DS.'components'.DS.'com_jfbconnect'.DS.'libraries'.DS.'facebook.php';
$jfbcLibrary = JFBConnectFacebookLibrary::getInstance();
$post = 'I just joined my school';
$post = 'URL of current page';
if ($jfbcLibrary->getUserId()) // Check if there is a Facebook user logged in
$jfbcLibrary->setFacebookMessage($post);

How would I echo $_SERVER or something similar to show a link to the page the post was sent from?

Thanks for you help

Hello,
have you tried:
$post['link'] = $_SERVER['REQUEST_URI'];
?

you might also want to consider using the 'Joomla Way':
$post['link'] = JURI::getInstance()->toString();
docs.joomla.org/JURI/getInstance

let us know if that helped.

Mati
The topic has been locked.