Question: I am migrating my Facebook canvas application to using the new PHP SDK. However, I am having a problem getting the JavaScript SDK to work too.

I'm wanting to take advantage of methods such as `stream.publish` in the JavaScript SDK. Unfortunately I've not been able to get anything to work thus far. I have the following in the header of my application's `index.php` file:

```
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_GB/all.js"></script>
<script>
    FB.init({appId: *);
    FB.ui({
        method: 'stream.publish',
        message: 'Check out this great app!'
    });
</script>

```

My application ID has been removed for obvious reasons.

Where I'd expect the above to give the user a prompt to publish a message to their stream, it's not. Can I even use the new JavaScript SDK in Facebook canvas applications? Or is it reserved for iFrame applications and utilizing Facebook Connect on websites only?

Answer: 
Try `$path = '/images/imagename.jpg;` that way you're are referencing from the document root path.
I would use [parse-url](http://php.net/manual/en/function.parse-url.php) and get the "path" argument as following:

```
<?php
  $url_tab = parse_url($path);
  echo $url_tab['path'];
?>

```

So you can keep the full version and get the path argument. 

Otherwize, you can keep the absolute path, and use the $\_SERVER['SERVER\_NAME'] to concatenate the path and get the full url.