Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #8586 > unrolled thread

Does PHP have a way to pass form data to a remote script?

Started bylichunshen84@gmail.com
First post2013-03-07 17:29 -0800
Last post2013-03-10 09:23 -0400
Articles 11 — 6 participants

Back to article view | Back to comp.lang.php


Contents

  Does PHP have a way to pass form data to a remote script? lichunshen84@gmail.com - 2013-03-07 17:29 -0800
    Re: Does PHP have a way to pass form data to a remote script? "Peter H. Coffin" <hellsop@ninehells.com> - 2013-03-07 20:10 -0600
      Re: Does PHP have a way to pass form data to a remote script? lichunshen84@gmail.com - 2013-03-07 18:39 -0800
        Re: Does PHP have a way to pass form data to a remote script? Scott Johnson <noonehome@chalupasworld.com> - 2013-03-07 18:54 -0800
          Re: Does PHP have a way to pass form data to a remote script? lichunshen84@gmail.com - 2013-03-07 19:00 -0800
            Re: Does PHP have a way to pass form data to a remote script? Jerry Stuckle <jstucklex@attglobal.net> - 2013-03-07 22:59 -0500
        Re: Does PHP have a way to pass form data to a remote script? "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2013-03-08 10:12 +0100
          Re: Does PHP have a way to pass form data to a remote script? padam <iarethebest@gmail.com> - 2013-03-09 08:29 -0800
            Re: Does PHP have a way to pass form data to a remote script? Jerry Stuckle <jstucklex@attglobal.net> - 2013-03-09 15:28 -0500
              Re: Does PHP have a way to pass form data to a remote script? padam <iarethebest@gmail.com> - 2013-03-09 21:07 -0800
                Re: Does PHP have a way to pass form data to a remote script? Jerry Stuckle <jstucklex@attglobal.net> - 2013-03-10 09:23 -0400

#8586 — Does PHP have a way to pass form data to a remote script?

Fromlichunshen84@gmail.com
Date2013-03-07 17:29 -0800
SubjectDoes PHP have a way to pass form data to a remote script?
Message-ID<4f1f5373-cbb1-4606-9355-7ed5adc1bf95@googlegroups.com>
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.

[toc] | [next] | [standalone]


#8587

From"Peter H. Coffin" <hellsop@ninehells.com>
Date2013-03-07 20:10 -0600
Message-ID<slrnkjii4f.m9f.hellsop@nibelheim.ninehells.com>
In reply to#8586
On Thu, 7 Mar 2013 17:29:34 -0800 (PST), lichunshen84@gmail.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.

[toc] | [prev] | [next] | [standalone]


#8589

Fromlichunshen84@gmail.com
Date2013-03-07 18:39 -0800
Message-ID<e5a79d8a-f4aa-4018-aed4-77713f734b9c@googlegroups.com>
In reply to#8587
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@gmail.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.

[toc] | [prev] | [next] | [standalone]


#8590

FromScott Johnson <noonehome@chalupasworld.com>
Date2013-03-07 18:54 -0800
Message-ID<khbjqt$mqh$1@dont-email.me>
In reply to#8589
On 3/7/2013 6:39 PM, lichunshen84@gmail.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@gmail.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?

[toc] | [prev] | [next] | [standalone]


#8591

Fromlichunshen84@gmail.com
Date2013-03-07 19:00 -0800
Message-ID<bc6c8d67-23a3-4551-bfc4-fdbd9b2b3a58@googlegroups.com>
In reply to#8590
On Thursday, March 7, 2013 9:54:30 PM UTC-5, Scott Johnson wrote:
> On 3/7/2013 6:39 PM, lichunshen84@gmail.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@gmail.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.

[toc] | [prev] | [next] | [standalone]


#8593

FromJerry Stuckle <jstucklex@attglobal.net>
Date2013-03-07 22:59 -0500
Message-ID<khbnjh$5i4$1@dont-email.me>
In reply to#8591
On 3/7/2013 10:00 PM, lichunshen84@gmail.com wrote:
> On Thursday, March 7, 2013 9:54:30 PM UTC-5, Scott Johnson wrote:
>> On 3/7/2013 6:39 PM, lichunshen84@gmail.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@gmail.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@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#8599

From"M. Strobel" <sorry_no_mail_here@nowhere.dee>
Date2013-03-08 10:12 +0100
Message-ID<aptobpFdg7sU1@mid.uni-berlin.de>
In reply to#8589
Am 08.03.2013 03:39, schrieb lichunshen84@gmail.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@gmail.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.

[toc] | [prev] | [next] | [standalone]


#8615

Frompadam <iarethebest@gmail.com>
Date2013-03-09 08:29 -0800
Message-ID<f9f8bd47-1dae-428b-adc2-1001cc188892@googlegroups.com>
In reply to#8599
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@gmail.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@gmail.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.

[toc] | [prev] | [next] | [standalone]


#8616

FromJerry Stuckle <jstucklex@attglobal.net>
Date2013-03-09 15:28 -0500
Message-ID<khg5ua$iv8$1@dont-email.me>
In reply to#8615
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@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#8622

Frompadam <iarethebest@gmail.com>
Date2013-03-09 21:07 -0800
Message-ID<f4a3ec71-1295-4f09-9a52-2fc3d54cf8b5@googlegroups.com>
In reply to#8616
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@attglobal.net
> 
> ==================

[toc] | [prev] | [next] | [standalone]


#8624

FromJerry Stuckle <jstucklex@attglobal.net>
Date2013-03-10 09:23 -0400
Message-ID<khi1dn$mq6$1@dont-email.me>
In reply to#8622
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@attglobal.net
==================

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web