RE: [PHP] Urgent help needed.

From: Date: Sat, 18 Nov 2000 19:14:40 +0000
Subject: RE: [PHP] Urgent help needed.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-26071@lists.php.net to get a copy of this message
On 19-Nov-00 Dallas Kropka wrote: > *Short Question* > > I need to be able to send a POST using a method other than forms or > sessions.... > > Can this be done with headers? > > *Long Description* > > I have a credit card form that has to go to authorize.net and has to be sent > through a post. This form is combined with a user information form. Both > sections are under the same <FORM> tag. I want to be able to check all the > data, post the data to a database, and then send the CC info to > Authorize.net. But since it all has to go to Authorize.net through the POST > method, Im running into a wall. I cant use sessions, and I cant just send > through the link. I MUST use post. > > > Can I POST without a form if not, what should I do??? > > function postheader($host, $path, $poststr) { $errno=0; $errstr=''; $hdr=sprintf("POST %s HTTP/1.0\r\nContent-Length: %d\r\n", $path,strlen($poststr)); $hdr .="Content-type: application/x-www-form-urlencoded\r\n"; $hdr .="Accept:text/html\r\nAccept: text/plain\r\n"; $hdr .="User-Agent: Mozilla/1.0\r\n\r\n"; $fp = fsockopen($host , 80, &$errno, &$errstr, 45); if(!$fp) { echo "$host open error: $errstr $errno .\n"; } else { fputs($fp,$hdr.$poststr); return($fp); } } -- Don Read dread@texas.net -- The problem with people who have no vices is that you can be sure they're going to have some pretty annoying virtues.

« previous php.general (#26071) next »