Is this posting to a form possible.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Is this posting to a form possible.

Post by tecktalkcm0391 »

I want to have variables like $first_name = 'Chris'; and stuff and send them to another site via post (thats all they except) and then fowarding a user to the page... with the same information i just posted. Is that possible? CURL?
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

I've never tried it... but could you do it through <form action="?">? Or does that restrict you to your own server? If not, it's that simple. Like I said though.. I've never needed to try.

Edit: I gave it a look and you can send posted variables to other sites just the way I described.
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

I know, but I wanted to keep the information more secure by not showing the user anything in the HTML.

EDIT: Just read http://netevil.org/node.php?nid=937 can that work where I post data, say to Paypal, and then foward the user along with the posted data.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

First question: What have you tried so far?
Second question: Are you talking about redirecting and posting at the same time? If so, this was just asked about three days ago.
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

I am so confused on how the CURL and stuff works, nothing yet. I want it to be like this. (if posssible) [which isn't what that 3 day old post did]

User clicks checkout.
PHP Pulls information from Database/Sessions...
POSTs or whatever Paypal needs over to paypal, then fowards them to where they enter there credit card information (on paypal).
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

I would just have your form action set to the Paypal processing page then.
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

I wanted it to check the database before it sent to check prices and other vaules to make sure the user hasn't tried to edit them
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Then you are going to have to use cURL. And more than likely you will have to tap into Paypal's API.
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

Ok, but I am really new at Paypal and this stuff. What do you mean my tapping into Paypal's API.
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

Everah wrote:Then you are going to have to use cURL. And more than likely you will have to tap into Paypal's API.
Also, can cURL send the user to the page after it sends the data?
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

No, you are going to have to redirect them with some other mechanism. A header() redirect perhaps...
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

But, wouldn't the data not be sent to the same page they are going to?
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Look into cURL and how it works. cURL will essentially reach out and post application data to another application on another domain. Redirecting, a wholly different thing, will simply take the user to another location. The two processes are totally different and need to be treated as such.
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

Ok, well i just found this: http://ilia.ws/archives/152-Cross-Domai ... ction.html couldn't i do something like that to get the information to paypal.

Edit: Nevermind, cause that data won't be posted it needs to be posted.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

I suppose you could try it.
Post Reply