I am the Perl programmer for our company, I know a little bit of PHP, but not near as much as our PHP programmer. He is doing one part of the company programming in PHP, and I am doing all the ecommerce, replication and sponsoring systems in Perl.

My question is this. When a new member signs up, I need to pass the PHP programmer three things. 1) the New Member ID, 2) the person that Referrered this new members' Id and 3) the position (always either left or right);

So I would assume to do it something like this:

# Perl Code in my system:
my $_response = `php /path/to/php/programs/passinfo.php memberid=$_memberId referrerid=$_referrerId position=$_mbrPosition`;

Then $_response should contain the output for me to let me know either "success" or "failure". So I am trying to test to make sure it works, and I cannot get my PHP script to read those variables that shell would pass to it via my script running and calling a unix command. I even tested it where it was not trying to pass a variable but a number just to see if it could read the posts.

I am just making sure it will work on my end before I send it to him ready to go.

Any ideas on how to pass it from Perl? I know this is not a Perl place and you guys probably all hate Perl, but I hope that some of you know what I'm talking about and what I can do to make this work.

Also, here is my Php script so you can see what I was trying to do to make it work:

<?php
$_SponsorId = $_GET['SPONSOR'] || $_get['SPONSOR'] || $_POST['SPONSOR'] || $argv['SPONSOR'] || $SPONSOR;
$_MemberId = $_GET['Id'] || $argv['Id'] || $_get['Id'] || $_POST['Id'] || $Id;
$_Position = $_GET['my_position'] || $argv['my_position'] || $_get['my_position'] || $_POST['my_position'] || $my_position;
echo "
Got it!! Sponsor ID is $_SponsorId and MemberId is $_MemberId while their position will be on the $_Position!
All Done
";
?>

my $_response string has this in the response, always:
Got it!! Sponsor ID is and MemberId is while their position will be on the !
All Done

So it is reading the echoed text, but apparantly, the variables are not being read into this.

I thank you in advance for any assistance you can offer me wth this.

    Is the PHP script being designed as a web application or a command line application (or possibly both)? If a command line application, then typically the parameters would be accessed via the $argv array.

    If it is a web application, then you might have to use whatever Perl mechanism you prefer (cURL?) to call the PHP script via a HTTP request, sending the parameters as a URL query string ("get" data).

    So I guess it depends on how the PHP developer is implementing it (or how you convince him to implement it).

      Well, I guess it will be a web application, but will only be ran by me posting those three fields to it, then he will take it from there in that same instant and do whatever he does, then pass me the response, then I'll finish the registration.

      So I am sure he will build it as a web application, but the only way I know to run a php script from perl is like I showed above, as a unix command: php file.php something=2 somethingelse=2;

      So if you know of a another way, that would help me.

      Anyhow, thanks for your reply. How do I use $argv? $argv[''] ?

      Thanks again.

        If a command line app, you would just pass the values:

        my $_response = `php /path/to/php/programs/passinfo.php $_memberId $_referrerId $_mbrPosition`;
        

        Then within the PHP script the values could be accessed as (changing variable names to whatever is desired):

        $memberId = $argv[1];
        $referrerId = $argv[2];
        $mbrPosition = $argv[3];
        
          Write a Reply...