Post with Redirect...

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

Post Reply
Nuzzi
Forum Newbie
Posts: 3
Joined: Tue Oct 21, 2008 9:20 am

Post with Redirect...

Post by Nuzzi »

Hello All,

I am fairly new to PHP and have to use it for a project am on right now. What I have to do is send information to a payment form through POST headers. I cannot use a form submit because I have to make decisions on the information given and fill in the fields to be sent appropriately. I tried cURL, but I couldn't seem to get it to actually transfer to the site, http_redirect didn't seem to work for some reason, and I don't want to just append the string onto the url. I am going to try to fill in the fields and submit the form on Page Load through Javascript, but was hoping to stay away from Javascript (for that small percentage of folks who have it turned off). Has anybody had experience with this? And, if so, how did you go about it?

Thank You,

NUZZI
Nuzzi
Forum Newbie
Posts: 3
Joined: Tue Oct 21, 2008 9:20 am

Re: Post with Redirect...

Post by Nuzzi »

Man, the cURL option is so close. It does everything right on except actually transfer to that site. Is it an option I am leaving out?

Thanks,

NUZZI
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Post with Redirect...

Post by requinix »

cURL is your friend. What does your code look like?
Nuzzi
Forum Newbie
Posts: 3
Joined: Tue Oct 21, 2008 9:20 am

Re: Post with Redirect...

Post by Nuzzi »

Hello,

Thanks for the reply. The code looked something like below. Of course, I tried about 20 different varieties of different options, but this was the one I thought would work.

Code: Select all

 
<?php
 
    $ch = curl_init();
    
    // Actual Values Omitted for Privacy
    $str = "postvar1=value1&postvar2=value2&postvar3=value3";
 
    curl_setopt($ch, CURLOPT_URL,"https://secure.bluefingateway.com/gw/native/interactive2.2" );
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1 );
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $str );
 
    curl_exec ($ch);
    curl_close ($ch); 
?>
 
NUZZI
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Post with Redirect...

Post by requinix »

Play around with some of the CURLOPT_SSL* options. Like the two VERIFY ones. Might need a certificate to connect to them or something, don't know.
Post Reply