Amember Remote XMLRPC Plugin Details + Fix for PHP 5.2.2

Discussion in 'Installation' started by getresults, Mar 17, 2009.

  1. getresults

    getresults Member

    Joined:
    Nov 1, 2006
    Messages:
    87
    Hi everyone.

    I bought the Amember Remote plugin yesterday from Amember (special request - it's not advertised on the site anywhere).

    I thought I'd put a little post up about my experience because there is practically no helpful information about this plugin anywhere as far as what it does and how to use it.

    I also have a fix for anyone using it with PHP 5.2.2 which causes it to break completely. I wasted 4 hours of my life locating the problem so hopefully this will save someone else some time & stress in future

    The Amember Remote plugin works like this.

    You have your main Amember site set up at www.myamembersite.com.

    You have a separate website with sales page for a product at: www.mycoolwidget.com

    At the bottom of the sales page at www.mycoolwidget.com you have a link that goes to Amember to purchase the product. For example.

    www.myamembersite.com/amember/signup.php?price_group=-1

    An order comes in and you process it and that's where the problem occurs - with Amember the protected members directory has to be on the same domain where Amember is installed.

    So buyers of www.mycoolwidget.com have to log into www.myamembersite.com/mycoolwidget to access their goodies.

    Which is were Amember Remote provides an awesome solution.

    It allows you to place the protected member directory on any remote domain.

    So now my users can buy from www.mycoolwidget.com and access their goodies in a protected directory on www.mycoolwidget.com/members while the control of their membership is still handled by Amember on www.myamembersite.com.


    Hopefully that provides some useful information to anyone else wondering about this plugin.


    ** VERY IMPORTANT: FIX FOR PHP 5.2.2 **

    PHP 5.2.2 has a really nasty bug that kills almost all variations of xmlrpc - not just for Amember, but for other software using xmlrpc as well.

    http://bugs.php.net/bug.php?id=41293

    This bug means that Amember Remote will NOT work if your main Amember install is on a PHP 5.2.2 server. It fails with no error messages, providing no clues at all about what is going wrong. :(

    Fixing it is simple.

    Edit amember/xmlrpc/index.php and add the following immediately after require_once('../config.inc.php'); :

    Code:
    /*   
     **  Fix for PHP 5.2.2 bug that breaks xmlrpc 
     **  See http://bugs.php.net/bug.php?id=41293
     */
     
    if (phpversion()=="5.2.2") $GLOBALS['HTTP_RAW_POST_DATA'] =
    file_get_contents("php://input");
    As soon as you do this the Amember Remote plugin will start working.

    I've let Amember support know and asked them to add the fix to the next update.
  2. powerkeys

    powerkeys Member

    Joined:
    Aug 29, 2006
    Messages:
    192
    Thanks for sharing your information on the remote plugin.

    However, I think we all know WHAT it is supposed to do. What we are probably more interested in is HOW does it do it? Do you place some PHP code on the remote website? Does aMember FTP to the remote domain's webspace? Does the protection mechanism use a different strategy?

    Also, I'm a bit confused because you refer to a special plugin, yet you also refer to the XML-RPC, which I see is included in the aMemberPro code, so I think this is standard. What is the difference between the two, and are they related to each other?
  3. codeispoetry

    codeispoetry aMember Pro Customer

    Joined:
    Jan 12, 2009
    Messages:
    336
    Hi Alan,

    Timely question! I have helped a client fix up his aMember Remote when moving servers recently.

    Yes, you place some PHP code on the remote website. aMember Remote communicates with the main program (aMember Pro) via XML-RPC.

    With aMember Remote, you are able to protect directories on the "remote" server while using the database from your "main" server.

    Cheers,
    Lee
  4. getresults

    getresults Member

    Joined:
    Nov 1, 2006
    Messages:
    87
    Good question. Here's how it works in more detail.

    Amember Remote isn't a normal plugin as such - you don't upload it to the plugins directory.

    It's a separate script you install in a directory (amember_remote for example) under the web root directory on the remote server.

    You can then log into /amember_remote/admin.php to configure it. In the configuration you specify the URL of your main Amember installation and the username and password for the XMLRPC interface.

    You can also change the username & password for the Amember Remote access.

    I've added a screen shot as an attachment.

    Amember Remote uses the XMLRPC protocol to pass data back and forth to the main Amember installation. So yes, XMLRPC needs to be turned on in Amember.

    Then Amember Remote can query such things as:

    * A list of products available so that you can choose which products have access to the remote protected directory.
    * The username & password and access permissions of someone trying to log into the remote directory.
    * Whether this is a real user in Amember?
    * Whether they have product access that allows them into this directory?
    * Whether their subscription current etc
  5. powerkeys

    powerkeys Member

    Joined:
    Aug 29, 2006
    Messages:
    192
    Thank you both for the absolutely perfect answers to my questions. Now I fully understand what the remote plugin is all about and I definitely want it!
  6. getresults

    getresults Member

    Joined:
    Nov 1, 2006
    Messages:
    87
    When I first heard about the mysterious "Remote Amember" plugin I couldn't find any useful information about how it works so I'm glad to help :)
  7. robaland

    robaland New Member

    Joined:
    Jan 28, 2007
    Messages:
    5
    Hey,

    I just bought the Amember_remote plugin and hit a snag.
    I tried to open the remote admin page and got this error message:

    Cannot open config. Copy file 'config-dist.inc.php' to 'config.inc.php' and try again.

    Directions say:

    Copy file 'config-dist.inc.php' to 'config.inc.php'

    I see both of these files on the www.myamembersite.com. I also see config-dist.inc.php on www.myremotesite,com too.

    Thanks for your help. ad

    Does this mean simply paste config-dist.inc.php into the file, or replace the config.inc.php.
  8. powerkeys

    powerkeys Member

    Joined:
    Aug 29, 2006
    Messages:
    192
    What the error message is asking you to do is to create a new file called "config.inc.php" which contains the same contents as the "config-dist.inc.php" file.

    If something else is needed, it's most likely to be permission settings on the new file, which will need to be either 666 or 777 for most Linux servers.
  9. robaland

    robaland New Member

    Joined:
    Jan 28, 2007
    Messages:
    5
    Alan,

    Thank you so much! I got it working. I apprecaite your help. Have fab day!

    Alan Davidson
  10. robaland

    robaland New Member

    Joined:
    Jan 28, 2007
    Messages:
    5
    Howdy from Houston.

    I got my amember_remote plugin configured. However, when i try to new_rewrtite protect my enhtire subdomain i get this error message:

    "File exists and contains non-aMember code unmodifiable by aMember. If you don't need this file, delete it and aMember will automatically create a new aMember compatible .htaccess file to replace it."

    I have no idea what file they are talking about. There is a flash movie on the landing page.

    Any ideas? Thanks ahead of time.
  11. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    This is about .htaccess file inside folder that you want to protect.
    Remove it (please backup old .htaccess just in case) then try to protect folder again, aMember will create own .htaccess file.
  12. raielschwartz

    raielschwartz New Member

    Joined:
    Jun 30, 2009
    Messages:
    4
    This sounds just like the plugin I need.

    Would I be able to do the below?

    I have a membership site... Lets call it membership site A, is there anyway for me to integrate my members with membership site A to give them access to membership site B (while membership site B is on a different web server).

    I wanted to work on a Joint Venture with someone who also uses amember. The deal would be my members would get full access to his membership site for being a member at my membership site.

    Can something like this be done? When member pays for membership site A, they also get access to membership site B. Also, if they unsubscribe from membership site A, it should also cancel membership at membership site B. We both use the latest version of aMember.
  13. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    I guess both sites have amember installed and site B should allow access to the same protected area for own members? There is no rady to use solution that allow to do this. But this can be done as customization.
  14. grlgeek

    grlgeek New Member

    Joined:
    Mar 17, 2010
    Messages:
    1
    I have the remote plugin working, but when I try to view the index.php page in the xmlrpc folder, it accepts my login information, but I'm getting the "XML-RPC server accepts POST requests only." message. The PHP version is 5.2.6, and the patch for 5.2.2 is in the index file, do I need to add something else to the file?
  15. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    No, this is ok. When you open it from browser it should generate above error.

Share This Page