Reply to Submit a form & go to the new page after validate

Your name:

Reply:


Posted by kelvin on 07/13/07 02:44

Hi,

A difficult question.

I have a form that I used to submit to https://www. paypal.com/cgi-bin/
webscr
<form action="https://www. paypal.com/cgi-bin/webscr" method="post">

Now I need to validate some inputs of this form, so I submit it to a
PHP page in my own server first.
<form action="paypal_upgrade_checking.php" method="post">

After validate, I need to submit the form again to https://www.
paypal.com/cgi-bin/webscr
I write a piece of PHP code but it failed. The browse is still in
paypal_upgrade_checking.php, it doesn't go to the new page.
I wonder whether there is a way to do it.


<?
....
$buf = '';

$req = '';

foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= "&$key=$value";
}

$header="";
$header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
$fp = fsockopen ('www.sandbox.paypal.com', 80, $errno, $errstr, 30);


if (!$fp) {
// HTTP ERROR
print "HTTP ERROR<br/>$errno<br/>$errstr";
exit();
} else {
fputs ($fp, $header . $req);
while(!feof($fp)) {
$buf.=fgets($fp,1024);
}
fclose($fp);
echo $buf;
}
?>

Thank you
Kelvin

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация