FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Does PHP have a way to pass form data to a remote script?
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Does PHP have a way to pass form data to a remote script? [message #180650] Fri, 08 March 2013 01:29 Go to next message
lichunshen84 is currently offline  lichunshen84
Messages: 3
Registered: March 2013
Karma: 0
Junior Member
Hi,

I'm not a php programmer but my customer is using Word Press and WooCommerce (I assume php is used to do the process etc.) for their order processing). What we would like to do is to add a function to pass the order data / form data to
a remote script so that the remote script can capture the form data as well, no need to get anything back to the caller (the current form processor).

Is it doable with php?

Thanks.
Re: Does PHP have a way to pass form data to a remote script? [message #180651 is a reply to message #180650] Fri, 08 March 2013 02:10 Go to previous messageGo to next message
Peter H. Coffin is currently offline  Peter H. Coffin
Messages: 245
Registered: September 2010
Karma: 0
Senior Member
On Thu, 7 Mar 2013 17:29:34 -0800 (PST), lichunshen84(at)gmail(dot)com wrote:

> Hi,
>
> I'm not a php programmer but my customer is using Word Press and
> WooCommerce (I assume php is used to do the process etc.) for their
> order processing). What we would like to do is to add a function to
> pass the order data / form data to a remote script so that the remote
> script can capture the form data as well, no need to get anything back
> to the caller (the current form processor).
>
> Is it doable with php?

Almost certainly yes. PHP support establishing network connections by
many means.

--
186,000 Miles per Second. It's not just a good idea. IT'S THE LAW.
Re: Does PHP have a way to pass form data to a remote script? [message #180653 is a reply to message #180651] Fri, 08 March 2013 02:39 Go to previous messageGo to next message
lichunshen84 is currently offline  lichunshen84
Messages: 3
Registered: March 2013
Karma: 0
Junior Member
On Thursday, March 7, 2013 9:10:23 PM UTC-5, Peter H. Coffin wrote:
> On Thu, 7 Mar 2013 17:29:34 -0800 (PST), lichunshen84(at)gmail(dot)com wrote:
>
>
>
>> Hi,
>
>>
>
>> I'm not a php programmer but my customer is using Word Press and
>
>> WooCommerce (I assume php is used to do the process etc.) for their
>
>> order processing). What we would like to do is to add a function to
>
>> pass the order data / form data to a remote script so that the remote
>
>> script can capture the form data as well, no need to get anything back
>
>> to the caller (the current form processor).
>
>>
>
>> Is it doable with php?
>
>
>
> Almost certainly yes. PHP support establishing network connections by
>
> many means.
>

Could you elaborate a bit? Even better, some sample code. Thanks.
Re: Does PHP have a way to pass form data to a remote script? [message #180654 is a reply to message #180653] Fri, 08 March 2013 02:54 Go to previous messageGo to next message
Scott Johnson is currently offline  Scott Johnson
Messages: 196
Registered: January 2012
Karma: 0
Senior Member
On 3/7/2013 6:39 PM, lichunshen84(at)gmail(dot)com wrote:
> On Thursday, March 7, 2013 9:10:23 PM UTC-5, Peter H. Coffin wrote:
>> On Thu, 7 Mar 2013 17:29:34 -0800 (PST), lichunshen84(at)gmail(dot)com wrote:
>>
>>
>>
>>> Hi,
>>
>>>
>>
>>> I'm not a php programmer but my customer is using Word Press and
>>
>>> WooCommerce (I assume php is used to do the process etc.) for their
>>
>>> order processing). What we would like to do is to add a function to
>>
>>> pass the order data / form data to a remote script so that the remote
>>
>>> script can capture the form data as well, no need to get anything back
>>
>>> to the caller (the current form processor).
>>
>>>
>>
>>> Is it doable with php?
>>
>>
>>
>> Almost certainly yes. PHP support establishing network connections by
>>
>> many means.
>>
>
> Could you elaborate a bit? Even better, some sample code. Thanks.
>

Sure whats the commission?
Re: Does PHP have a way to pass form data to a remote script? [message #180655 is a reply to message #180654] Fri, 08 March 2013 03:00 Go to previous messageGo to next message
lichunshen84 is currently offline  lichunshen84
Messages: 3
Registered: March 2013
Karma: 0
Junior Member
On Thursday, March 7, 2013 9:54:30 PM UTC-5, Scott Johnson wrote:
> On 3/7/2013 6:39 PM, lichunshen84(at)gmail(dot)com wrote:
>
>> On Thursday, March 7, 2013 9:10:23 PM UTC-5, Peter H. Coffin wrote:
>
>>> On Thu, 7 Mar 2013 17:29:34 -0800 (PST), lichunshen84(at)gmail(dot)com wrote:
>
>>>
>
>>>
>
>>>
>
>>>> Hi,
>
>>>
>
>>>>
>
>>>
>
>>>> I'm not a php programmer but my customer is using Word Press and
>
>>>
>
>>>> WooCommerce (I assume php is used to do the process etc.) for their
>
>>>
>
>>>> order processing). What we would like to do is to add a function to
>
>>>
>
>>>> pass the order data / form data to a remote script so that the remote
>
>>>
>
>>>> script can capture the form data as well, no need to get anything back
>
>>>
>
>>>> to the caller (the current form processor).
>
>>>
>
>>>>
>
>>>
>
>>>> Is it doable with php?
>
>>>
>
>>>
>
>>>
>
>>> Almost certainly yes. PHP support establishing network connections by
>
>>>
>
>>> many means.
>
>>>
>
>>
>
>> Could you elaborate a bit? Even better, some sample code. Thanks.
>
>>
>
>
>
> Sure whats the commission?

First time, to hear about commission on such a forum. In the meantime, a favor rendered a favor will be returned when an opportunity arises.
Re: Does PHP have a way to pass form data to a remote script? [message #180657 is a reply to message #180655] Fri, 08 March 2013 03:59 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 3/7/2013 10:00 PM, lichunshen84(at)gmail(dot)com wrote:
> On Thursday, March 7, 2013 9:54:30 PM UTC-5, Scott Johnson wrote:
>> On 3/7/2013 6:39 PM, lichunshen84(at)gmail(dot)com wrote:
>>
>>> On Thursday, March 7, 2013 9:10:23 PM UTC-5, Peter H. Coffin wrote:
>>
>>>> On Thu, 7 Mar 2013 17:29:34 -0800 (PST), lichunshen84(at)gmail(dot)com wrote:
>>
>>>>
>>
>>>>
>>
>>>>
>>
>>>> > Hi,
>>
>>>>
>>
>>>> >
>>
>>>>
>>
>>>> > I'm not a php programmer but my customer is using Word Press and
>>
>>>>
>>
>>>> > WooCommerce (I assume php is used to do the process etc.) for their
>>
>>>>
>>
>>>> > order processing). What we would like to do is to add a function to
>>
>>>>
>>
>>>> > pass the order data / form data to a remote script so that the remote
>>
>>>>
>>
>>>> > script can capture the form data as well, no need to get anything back
>>
>>>>
>>
>>>> > to the caller (the current form processor).
>>
>>>>
>>
>>>> >
>>
>>>>
>>
>>>> > Is it doable with php?
>>
>>>>
>>
>>>>
>>
>>>>
>>
>>>> Almost certainly yes. PHP support establishing network connections by
>>
>>>>
>>
>>>> many means.
>>
>>>>
>>
>>>
>>
>>> Could you elaborate a bit? Even better, some sample code. Thanks.
>>
>>>
>>
>>
>>
>> Sure whats the commission?
>
> First time, to hear about commission on such a forum. In the meantime, a favor rendered a favor will be returned when an opportunity arises.
>
>

In this newsgroup (this is usenet - NOT a forum), volunteers are helping
each other. We're doing this on our own time. We'll help you with your
code - but if you want someone to just write it for you, hire a
consultant.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Does PHP have a way to pass form data to a remote script? [message #180663 is a reply to message #180653] Fri, 08 March 2013 09:12 Go to previous messageGo to next message
M. Strobel is currently offline  M. Strobel
Messages: 386
Registered: December 2011
Karma: 0
Senior Member
Am 08.03.2013 03:39, schrieb lichunshen84(at)gmail(dot)com:
> On Thursday, March 7, 2013 9:10:23 PM UTC-5, Peter H. Coffin wrote:
>> On Thu, 7 Mar 2013 17:29:34 -0800 (PST), lichunshen84(at)gmail(dot)com wrote:
>>
>>
>>
>>> Hi,
>>
>>>
>>
>>> I'm not a php programmer but my customer is using Word Press and
>>
>>> WooCommerce (I assume php is used to do the process etc.) for their
>>
>>> order processing). What we would like to do is to add a function to
>>
>>> pass the order data / form data to a remote script so that the remote
>>
>>> script can capture the form data as well, no need to get anything back
>>
>>> to the caller (the current form processor).
>>
>>>
>>
>>> Is it doable with php?
>>
>>
>>
>> Almost certainly yes. PHP support establishing network connections by
>>
>> many means.
>>
>
> Could you elaborate a bit? Even better, some sample code. Thanks.
>
Introduction

PHP supports libcurl, a library created by Daniel Stenberg, that allows you to
connect and communicate to many different types of servers with many different types
of protocols. libcurl currently supports the http, https, ftp, gopher, telnet, dict,
file, and ldap protocols. libcurl also supports HTTPS certificates, HTTP POST, HTTP
PUT, FTP uploading (this can also be done with PHP's ftp extension), HTTP form based
upload, proxies, cookies, and user+password authentication.

These functions have been added in PHP 4.0.2.

/Str.
Re: Does PHP have a way to pass form data to a remote script? [message #180679 is a reply to message #180663] Sat, 09 March 2013 16:29 Go to previous messageGo to next message
iarethebest is currently offline  iarethebest
Messages: 3
Registered: March 2013
Karma: 0
Junior Member
Strobel is correct, cURL is likely the way to go. Typically, the ideal way to go about it would be to modify the page that the form posts to (e.g. <form method="post" action="XXX"> - where XXX is what you want to pay attention to). For example, at the top of that script, you'd add something to the effect of:

<?php
// CONFIRM THAT POST DATA IS PRESENT
if (@!empty($_POST)) {
// DEFINE REMOTE URL TO POST TO
define("REMOTE_POSTURL", "http://second.site.com/scripts/example.php");
// GRAB AND FORMAT INCOMING POST DATA
foreach ($_POST as $pKey=>$pVal) { @$postData .= "$pKey=$pVal&"; }
// REMOVE TRAILING AMPERSANDS
$postData = rtrim($postData, "&");
// CREATE/INITIALIZE CURL
$ch = curl_init(REMOTE_POSTURL);
// SET VARIOUS OPTIONS
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
// FINALLY, EXECUTE REQUEST AND CLOSE HANDLE
curl_exec($ch);
curl_close($ch);
}
?>

On Friday, March 8, 2013 3:12:25 AM UTC-6, M. Strobel wrote:
> Am 08.03.2013 03:39, schrieb lichunshen84(at)gmail(dot)com:
>
>> On Thursday, March 7, 2013 9:10:23 PM UTC-5, Peter H. Coffin wrote:
>
>>> On Thu, 7 Mar 2013 17:29:34 -0800 (PST), lichunshen84(at)gmail(dot)com wrote:
>
>>>
>
>>>
>
>>>
>
>>>> Hi,
>
>>>
>
>>>>
>
>>>
>
>>>> I'm not a php programmer but my customer is using Word Press and
>
>>>
>
>>>> WooCommerce (I assume php is used to do the process etc.) for their
>
>>>
>
>>>> order processing). What we would like to do is to add a function to
>
>>>
>
>>>> pass the order data / form data to a remote script so that the remote
>
>>>
>
>>>> script can capture the form data as well, no need to get anything back
>
>>>
>
>>>> to the caller (the current form processor).
>
>>>
>
>>>>
>
>>>
>
>>>> Is it doable with php?
>
>>>
>
>>>
>
>>>
>
>>> Almost certainly yes. PHP support establishing network connections by
>
>>>
>
>>> many means.
>
>>>
>
>>
>
>> Could you elaborate a bit? Even better, some sample code. Thanks.
>
>>
>
> Introduction
>
>
>
> PHP supports libcurl, a library created by Daniel Stenberg, that allows you to
>
> connect and communicate to many different types of servers with many different types
>
> of protocols. libcurl currently supports the http, https, ftp, gopher, telnet, dict,
>
> file, and ldap protocols. libcurl also supports HTTPS certificates, HTTP POST, HTTP
>
> PUT, FTP uploading (this can also be done with PHP's ftp extension), HTTP form based
>
> upload, proxies, cookies, and user+password authentication.
>
>
>
> These functions have been added in PHP 4.0.2.
>
>
>
> /Str.
Re: Does PHP have a way to pass form data to a remote script? [message #180680 is a reply to message #180679] Sat, 09 March 2013 20:28 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 3/9/2013 11:29 AM, padam wrote:
> Strobel is correct, cURL is likely the way to go. Typically, the ideal way to go about it would be to modify the page that the form posts to (e.g. <form method="post" action="XXX"> - where XXX is what you want to pay attention to). For example, at the top of that script, you'd add something to the effect of:
>

<snip code>

What a bunch of crap code. I'd be embarrassed to even admit that was my
code. But then that's the type of "quality" I expect from Google Groupies.

And it doesn't necessarily do what the OP wants - in fact, it probably
does not; the OP was very unclear about his requirements.

P.S. Please don't top post.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Does PHP have a way to pass form data to a remote script? [message #180686 is a reply to message #180680] Sun, 10 March 2013 05:07 Go to previous messageGo to next message
iarethebest is currently offline  iarethebest
Messages: 3
Registered: March 2013
Karma: 0
Junior Member
Nice blanket statement. The code is clear, concise and works effectively well for the situation described in the original post.

Your inability to understand his requirements is _your_ burden to carry, it is not mine and it is not his.

Reminder: if there were anything wrong with the code, be it syntax, concept, implementation, etc: you'd have specifically pointed such out (because apparently, your ego is the only important element in this discussion). But, as we can all see, you didn't and it's crystal clear why.

Lastly, the Google Groups comment only serves to expose your own ignorance. As if the medium used for communication in some way dictates anything regarding content/quality. Usually when someone's condescending, it's because they at least have _somewhat_ of a reason to be. In this case, the exact opposite is true. There was absolutely no substance to _any_ part of that _entire_ post.

On Saturday, March 9, 2013 2:28:18 PM UTC-6, Jerry Stuckle wrote:
> On 3/9/2013 11:29 AM, padam wrote:
>
>> Strobel is correct, cURL is likely the way to go. Typically, the ideal way to go about it would be to modify the page that the form posts to (e.g. <form method="post" action="XXX"> - where XXX is what you want to pay attention to). For example, at the top of that script, you'd add something to the effect of:
>
>>
>
>
>
> <snip code>
>
>
>
> What a bunch of crap code. I'd be embarrassed to even admit that was my
>
> code. But then that's the type of "quality" I expect from Google Groupies.
>
>
>
> And it doesn't necessarily do what the OP wants - in fact, it probably
>
> does not; the OP was very unclear about his requirements.
>
>
>
> P.S. Please don't top post.
>
>
>
>
>
> --
>
> ==================
>
> Remove the "x" from my email address
>
> Jerry Stuckle
>
> JDS Computer Training Corp.
>
> jstucklex(at)attglobal(dot)net
>
> ==================
Re: Does PHP have a way to pass form data to a remote script? [message #180688 is a reply to message #180686] Sun, 10 March 2013 13:23 Go to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 3/10/2013 12:07 AM, padam wrote:
> Nice blanket statement. The code is clear, concise and works effectively well for the situation described in the original post.
>
> Your inability to understand his requirements is _your_ burden to carry, it is not mine and it is not his.
>
> Reminder: if there were anything wrong with the code, be it syntax, concept, implementation, etc: you'd have specifically pointed such out (because apparently, your ego is the only important element in this discussion). But, as we can all see, you didn't and it's crystal clear why.
>
> Lastly, the Google Groups comment only serves to expose your own ignorance. As if the medium used for communication in some way dictates anything regarding content/quality. Usually when someone's condescending, it's because they at least have _somewhat_ of a reason to be. In this case, the exact opposite is true. There was absolutely no substance to _any_ part of that _entire_ post.
>

Exactly what I would expect from someone who refuses to follow newsgroup
guidelines.

To start - the code is crap, with minimal error checking and suppression
of potential errors. It assumes you are posting data to a remote URL,
and the source of that data is a POST, that all the data posted to the
current page (and nothing else) is to be posted to the remote site. I
could go on, but I won't. It does NOT solve the user's problem - but
you're too stoopid to understand that. It's probably something you
copied from some site on the internet, but don't even understand what
you posted.

And the Google Groups comment is right on, as you post once again
proved. The members of this and other newsgroups have seen the results
provided by Google Groupies. They are almost universally bad - but
usually not nearly as bad as the crap you posted.

I see why you use a 'nym. I'd be embarrassed to post this crap under my
real name, also.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: How to get the system date in PHP
Next Topic: Webapp PHP executing external java programs
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Dec 18 02:20:08 GMT 2024

Total time taken to generate the page: 0.02541 seconds