need help with $_POST variables

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • admin@worstofboston.com

    need help with $_POST variables

    Hi,

    I have a mysql box that has a private network ip. The old developer was
    running our web server on this machine but the company since retired
    the box and it is in a closet, still running, but sad and alone,
    aliased as oldserver.mycom pany.com.

    Now I am finding out that I need to use some of the funcitonality in
    the scripts that are on the old box.

    So, I just installed PHP on our new IIS webserver.

    I have a form that he built which collects information from potential
    clients and then passes it on for entry in the database (on the old
    box), sends out emails, does calculations, and so on and so forth. It
    does a lot, actually.

    I cannot build a form to pass directly to this mysql box because it
    does not have a public IP. I cannot submit directly to a private IP.
    Found this out recently.

    So I was thinking I could have the form submit to our web server, and
    they my web server could in turn submit the $_POST variables to the
    private box.

    This should work, no?

    My problem is, I need to create a file on my web server that will do
    nothing but take the $_POST variables and hand them off to the private
    box for processing.

    How can I take $_POST and repost it?

    It is probably not difficult, but I am new to PHP. I have looked,
    cannot find the answer.

    I would not be able to press a button, so the submission would have to
    be automatic.

    Is this possible?

    Can you help? I truly appreciate it. I need to get this up... as a
    temporary solution... then I can try to duplicate the functionality on
    the private box with the web server.

    All I want to do is take the $_POST variables from the form and pass
    them to an intermediary script that is able to talk to the private box,
    and then have that intermediary script pass them along again as a
    $_POST array.

    Thanks a lot!!!!!!

    Frank

  • ZeldorBlat

    #2
    Re: need help with $_POST variables


    admin@worstofbo ston.com wrote:
    Hi,
    >
    I have a mysql box that has a private network ip. The old developer was
    running our web server on this machine but the company since retired
    the box and it is in a closet, still running, but sad and alone,
    aliased as oldserver.mycom pany.com.
    >
    Now I am finding out that I need to use some of the funcitonality in
    the scripts that are on the old box.
    >
    So, I just installed PHP on our new IIS webserver.
    >
    I have a form that he built which collects information from potential
    clients and then passes it on for entry in the database (on the old
    box), sends out emails, does calculations, and so on and so forth. It
    does a lot, actually.
    >
    I cannot build a form to pass directly to this mysql box because it
    does not have a public IP. I cannot submit directly to a private IP.
    Found this out recently.
    >
    So I was thinking I could have the form submit to our web server, and
    they my web server could in turn submit the $_POST variables to the
    private box.
    >
    This should work, no?
    >
    My problem is, I need to create a file on my web server that will do
    nothing but take the $_POST variables and hand them off to the private
    box for processing.
    >
    How can I take $_POST and repost it?
    >
    It is probably not difficult, but I am new to PHP. I have looked,
    cannot find the answer.
    >
    I would not be able to press a button, so the submission would have to
    be automatic.
    >
    Is this possible?
    >
    Can you help? I truly appreciate it. I need to get this up... as a
    temporary solution... then I can try to duplicate the functionality on
    the private box with the web server.
    >
    All I want to do is take the $_POST variables from the form and pass
    them to an intermediary script that is able to talk to the private box,
    and then have that intermediary script pass them along again as a
    $_POST array.
    >
    Thanks a lot!!!!!!
    >
    Frank
    Use the curl functions (http://www.php.net/curl). Here's how:

    $ch = curl_init("http ://oldserver.mycom pany.com/somepage.php");
    curl_setopt($ch , CURLOPT_POST); //use the POST method
    curl_setopt($ch , CURLOPT_POSTFIE LDS, $_POST); //take the $_POST array
    and use those as the POST parameters for the curl request
    curl_exec($ch); //execute the request

    Comment

    • admin@worstofboston.com

      #3
      Re: need help with $_POST variables

      I know nothing about cURL

      guess Ill have to learn

      thanks...

      Comment

      • admin@worstofboston.com

        #4
        Re: need help with $_POST variables


        ZeldorBlat wrote:
        admin@worstofbo ston.com wrote:
        Hi,

        I have a mysql box that has a private network ip. The old developer was
        running our web server on this machine but the company since retired
        the box and it is in a closet, still running, but sad and alone,
        aliased as oldserver.mycom pany.com.

        Now I am finding out that I need to use some of the funcitonality in
        the scripts that are on the old box.

        So, I just installed PHP on our new IIS webserver.

        I have a form that he built which collects information from potential
        clients and then passes it on for entry in the database (on the old
        box), sends out emails, does calculations, and so on and so forth. It
        does a lot, actually.

        I cannot build a form to pass directly to this mysql box because it
        does not have a public IP. I cannot submit directly to a private IP.
        Found this out recently.

        So I was thinking I could have the form submit to our web server, and
        they my web server could in turn submit the $_POST variables to the
        private box.

        This should work, no?

        My problem is, I need to create a file on my web server that will do
        nothing but take the $_POST variables and hand them off to the private
        box for processing.

        How can I take $_POST and repost it?

        It is probably not difficult, but I am new to PHP. I have looked,
        cannot find the answer.

        I would not be able to press a button, so the submission would have to
        be automatic.

        Is this possible?

        Can you help? I truly appreciate it. I need to get this up... as a
        temporary solution... then I can try to duplicate the functionality on
        the private box with the web server.

        All I want to do is take the $_POST variables from the form and pass
        them to an intermediary script that is able to talk to the private box,
        and then have that intermediary script pass them along again as a
        $_POST array.

        Thanks a lot!!!!!!

        Frank
        >
        Use the curl functions (http://www.php.net/curl). Here's how:
        >
        $ch = curl_init("http ://oldserver.mycom pany.com/somepage.php");
        curl_setopt($ch , CURLOPT_POST); //use the POST method
        curl_setopt($ch , CURLOPT_POSTFIE LDS, $_POST); //take the $_POST array
        and use those as the POST parameters for the curl request
        curl_exec($ch); //execute the request
        This is a great response. I really thank you for taking the time to
        answer me.

        Do both servers need to have curl enabled?

        I am getting this error:


        Warning: Wrong parameter count for curl_setopt() in D:\ULEM
        WebSite\forms\m iddle.php on line 5 (This is the code above that you
        wrote)
        Message was not sent
        Please tell the Administrator: Mailer Error: Could not instantiate mail
        function.PHP Warning: Cannot open 'C:\\Program Files\PHP\extra s' for
        reading in Unknown on line 0

        Comment

        • admin@worstofboston.com

          #5
          Re: need help with $_POST variables

          I am getting this error:
          >
          >
          Warning: Wrong parameter count for curl_setopt() in D:\ULEM
          WebSite\forms\m iddle.php on line 5 (This is the code above that you
          wrote)
          Message was not sent
          Please tell the Administrator: Mailer Error: Could not instantiate mail
          function.PHP Warning: Cannot open 'C:\\Program Files\PHP\extra s' for
          reading in Unknown on line 0
          I have been told that CURLOPT_POSTFIE LDS expects a string, so $_POST
          will not work??? It also happens that many elements of my $_POST array
          are arrays...

          I am in over my head here...

          I apologize for all the questions...

          Comment

          • Jerry Stuckle

            #6
            Re: need help with $_POST variables

            admin@worstofbo ston.com wrote:
            >>I am getting this error:
            >>
            >>
            >>Warning: Wrong parameter count for curl_setopt() in D:\ULEM
            >>WebSite\forms \middle.php on line 5 (This is the code above that you
            >>wrote)
            >>Message was not sent
            >>Please tell the Administrator: Mailer Error: Could not instantiate mail
            >>function.PH P Warning: Cannot open 'C:\\Program Files\PHP\extra s' for
            >>reading in Unknown on line 0
            >
            >
            I have been told that CURLOPT_POSTFIE LDS expects a string, so $_POST
            will not work??? It also happens that many elements of my $_POST array
            are arrays...
            >
            I am in over my head here...
            >
            I apologize for all the questions...
            >
            No, you can't use arrays - but then you can't send a PHP array in a
            header, anyway. You'll have to parse your $_POST array out into id/value
            pairs, just like you would see in a GET with parameters.

            --
            =============== ===
            Remove the "x" from my email address
            Jerry Stuckle
            JDS Computer Training Corp.
            jstucklex@attgl obal.net
            =============== ===

            Comment

            • ZeldorBlat

              #7
              Re: need help with $_POST variables


              Jerry Stuckle wrote:
              admin@worstofbo ston.com wrote:
              >I am getting this error:
              >
              >
              >Warning: Wrong parameter count for curl_setopt() in D:\ULEM
              >WebSite\forms\ middle.php on line 5 (This is the code above that you
              >wrote)
              >Message was not sent
              >Please tell the Administrator: Mailer Error: Could not instantiate mail
              >function.PHP Warning: Cannot open 'C:\\Program Files\PHP\extra s' for
              >reading in Unknown on line 0

              I have been told that CURLOPT_POSTFIE LDS expects a string, so $_POST
              will not work??? It also happens that many elements of my $_POST array
              are arrays...

              I am in over my head here...

              I apologize for all the questions...
              >
              No, you can't use arrays - but then you can't send a PHP array in a
              header, anyway. You'll have to parse your $_POST array out into id/value
              pairs, just like you would see in a GET with parameters.
              >
              It depends on which version of PHP and curl you are using. Some will
              let you just give it an array. You can always use http_build_quer y()
              to make the conversion easy:



              Comment

              Working...