user1515357
user1515357

Reputation: 11

Using $_GET to retrieve mycustomvariable

I am trying to use the $_GET operator in php to get mycusomvariable from an fb app url to try to append a username, and find that this appears to return no details?

As an example here is the url I'm posting to Facebook:

http://apps.facebook.com/my-app-namespace?username=Test

and here is the php code which should retrieve the string 'Test'

    <?php

      $username = $_GET ['username'];
      echo $username;

    ?>

This should show up in the browser as Test, but shows nothing.

Anyone any ideas on where I'm going wrong?

Upvotes: 1

Views: 106

Answers (4)

R00We
R00We

Reputation: 1981

Try to rename variable username to something else. Maybe Facebook has blocked that variable name.
Example: http://apps.facebook.com/my-app-namespace?qwerty=Test

<?php
  $username = $_GET ['qwerty'];
  echo $username;
?>

Upvotes: 0

j. Armstrong
j. Armstrong

Reputation: 96

As I know facebook applications are running in the <iframe>. If it is true, then you can not get access to the global $_GET array in your application.

Upvotes: 0

user975343
user975343

Reputation:

if(isset($_GET['username'])){
echo " fine" ;
else { 
echo "not set" ; 

And search google for url variables

Upvotes: 0

nyxthulhu
nyxthulhu

Reputation: 9752

Are you possibly running a old version of PHP, the $_GET command was added in PHP 4.1.0. Try a <?php phpinfo(); ?> to get your current version.

Have a look at the PHP Documentation which shows version numbers.

Upvotes: 1

Related Questions