sending form post data

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • james

    sending form post data

    How can I have a php script send data to a URL as form post data from
    within the script without creating an actual form in a web page.

    I am working with an affiliate program (from Affiliateshop) and the
    instructions are 'have your script send a form post with the name of the
    form fields "AID" and "BID" and their values to the following URL string...'

    Thanks

    james
  • Daniel Tryba

    #2
    Re: sending form post data

    james <jd@venus.com > wrote:[color=blue]
    > How can I have a php script send data to a URL as form post data from
    > within the script without creating an actual form in a web page.[/color]

    You are the first person to ask that question here... But not really:


    :)

    Comment

    • BKDotCom

      #3
      Re: sending form post data

      and you might want to see if a GET works..
      instructions could have been written by a bonehead

      Comment

      • Safe

        #4
        Re: sending form post data

        You need PEAR class (http://pear.php.net/package/HTTP_Request)

        require_once "Request/Request.php";
        $req =& new HTTP_Request("{ URL}/");
        $req->addHeader("Con tent-Type", "applicatio n/x-www-form-urlencoded");
        $req->addPostData("{ vaiable}", "{value}");
        ....
        if (!PEAR::isError ($req->sendRequest()) ) {
        $response1 = $req->getResponseBod y();
        } else {
        $response1 = "";
        }

        Comment

        Working...