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

Manually make a POST request?

P: n/a
I'm writing a little Drupal module that implements a couple forms,
relaying the submitted values to a third-party site. I know the target
URL and I have all of the values that I want to submit with the POST
request, so how can I invoke this request directly from a PHP script?
Oct 29 '08 #1
Share this Question
Share on Google+
6 Replies


P: n/a
703designs wrote:
I'm writing a little Drupal module that implements a couple forms,
relaying the submitted values to a third-party site. I know the target
URL and I have all of the values that I want to submit with the POST
request, so how can I invoke this request directly from a PHP script?
I am not 100% on this but I think it can be accomplished with 'curl'.

http://us2.php.net/curl

Let me know if that works for you.

Scotty
Oct 29 '08 #2

P: n/a
Unless Curl isn't installed, of course. On most servers, this is fine,
but I'm stuck developing on a Windows box right now. I'm tinkering
with socket functions, and I could always use this utility function:
http://www.jonasjohn.de/snippets/php/post-request.htm

Thomas

On Oct 29, 2:40*pm, FutureShock <futuresho...@att.netwrote:
703designs wrote:
I'm writing a little Drupal module that implements a couple forms,
relaying the submitted values to a third-party site. I know the target
URL and I have all of the values that I want to submit with the POST
request, so how can I invoke this request directly from a PHP script?

I am not 100% on this but I think it can be accomplished with 'curl'.

http://us2.php.net/curl

Let me know if that works for you.

Scotty
Oct 29 '08 #3

P: n/a
On Oct 29, 7:56*pm, 703designs <thomasmal...@gmail.comwrote:
Unless Curl isn't installed, of course. On most servers, this is fine,
but I'm stuck developing on a Windows box right now. I'm tinkering
with socket functions, and I could always use this utility function:http://www.jonasjohn.de/snippets/php/post-request.htm

Thomas

On Oct 29, 2:40*pm, FutureShock <futuresho...@att.netwrote:
703designs wrote:
I'm writing a little Drupal module that implements a couple forms,
relaying the submitted values to a third-party site. I know the target
URL and I have all of the values that I want to submit with the POST
request, so how can I invoke this request directly from a PHP script?
I am not 100% on this but I think it can be accomplished with 'curl'.
http://us2.php.net/curl
Let me know if that works for you.
Scotty

You should be able to use the curl extension on a Windows box.
Oct 29 '08 #4

P: n/a
703designs wrote:
On Oct 29, 2:40 pm, FutureShock <futuresho...@att.netwrote:
>703designs wrote:
>>I'm writing a little Drupal module that implements a couple forms,
relaying the submitted values to a third-party site. I know the target
URL and I have all of the values that I want to submit with the POST
request, so how can I invoke this request directly from a PHP script?
I am not 100% on this but I think it can be accomplished with 'curl'.

http://us2.php.net/curl

Let me know if that works for you.
Unless Curl isn't installed, of course. On most servers, this is fine,
but I'm stuck developing on a Windows box right now. I'm tinkering
with socket functions, and I could always use this utility function:
http://www.jonasjohn.de/snippets/php/post-request.htm
(Top-posting fixed.)

cURL works just as well on Windows. However, you should not need it
unless you need to things like accept cookies or, perhaps, deal with SSL.

You should be able to use fsockopen(), otherwise. Using google, you
can figure out how to send a POST request. The HTTP RFC, for example
might help.

<URL:http://php.net/fsockopen>

P.S.: most people prefer bottom-posting.
--
Curtis
$eMail = str_replace('sig.invalid', 'gmail.com', $from);
Oct 30 '08 #5

P: n/a
NC
On Oct 29, 11:18 am, 703designs <thomasmal...@gmail.comwrote:
>
I'm writing a little Drupal module that implements a couple
forms, relaying the submitted values to a third-party site.
I know the target URL and I have all of the values that I
want to submit with the POST request, so how can I invoke
this request directly from a PHP script?
Use cURL or, should cURL be unavailable, check out this old post of
mine in alt.php:

http://groups.google.com/group/alt.p...61757c923ebf40

Cheers,
NC
Oct 30 '08 #6

P: n/a
Drupal's drupal_http_request() is great :) Problem solved. I actually
ended up using drupal_goto() because it's a GET request (this was
easier).

Thomas

On Oct 29, 8:18*pm, Curtis <dye...@sig.invalidwrote:
703designs wrote:
On Oct 29, 2:40 pm, FutureShock <futuresho...@att.netwrote:
703designs wrote:
I'm writing a little Drupal module that implements a couple forms,
relaying the submitted values to a third-party site. I know the target
URL and I have all of the values that I want to submit with the POST
request, so how can I invoke this request directly from a PHP script?
I am not 100% on this but I think it can be accomplished with 'curl'.
>http://us2.php.net/curl
Let me know if that works for you.
Unless Curl isn't installed, of course. On most servers, this is fine,
but I'm stuck developing on a Windows box right now. I'm tinkering
with socket functions, and I could always use this utility function:
http://www.jonasjohn.de/snippets/php/post-request.htm

(Top-posting fixed.)

cURL works just as well on Windows. However, you should not need it
unless you need to things like accept cookies or, perhaps, deal with SSL.

You should be able to use fsockopen(), otherwise. Using google, you
can figure out how to send a POST request. The HTTP RFC, for example
might help.

<URL:http://php.net/fsockopen>

P.S.: most people prefer bottom-posting.
--
Curtis
$eMail = str_replace('sig.invalid', 'gmail.com', $from);
Oct 30 '08 #7

This discussion thread is closed

Replies have been disabled for this discussion.