By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,747 Members | 1,482 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,747 IT Pros & Developers. It's quick & easy.

sending form post data

P: n/a
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
Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
james <jd@venus.com> wrote:
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.


You are the first person to ask that question here... But not really:
http://groups.google.co.uk/groups?as...=comp.lang.php

:)

Jul 17 '05 #2

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

Jul 17 '05 #3

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

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

Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.