From: a dot erler at brain-at-work dot de
Operating system: Debian
PHP version: 4.3.1
PHP Bug Type: Sockets related
Bug description: No access to posted variables via socket connection
Description:
------------
I'm trying to send some variables via POST with a socket connection to a
HTML form.
The problem:
The socket connection returns HTML-code from the form, but in the form I
can't access the variables I sent (e.g. "go" is not set in $HTTP_POST_VARS
and not in the global scope).
I took the sample code from the PHP manual, section "Stream functions",
"Example 2. Making a POST request to an https server".
I think it should be no problem, that there are additional GET-parameters
in the URI "d_content_kontakt.php" !?
Reproduce code:
---------------
$sock = fsockopen("linux", 80, $errno, $errstr, 30);
$data = 'go='.urlencode('sent');
fputs($sock, "POST
/caranet_redesign/d_content_kontakt.php?art_angebot=Gebrauchtwagen&id_haendler=00000002&id_lang=00000001&typ=rm&hersteller=&schlafplaetze=&preis_von=&preis_bis=&id_fahrzeuge=00002158
HTTP/1.0\r\n");
fputs($sock, "Host: linux\r\n");
fputs($sock, "Content-type: application/x-www-url-encoded\r\n");
fputs($sock, "Content-length: " . strlen($data) . "\r\n");
fputs($sock, "Accept: */*\r\n");
fputs($sock, "\r\n");
fputs($sock, "$data\r\n");
fputs($sock, "\r\n");
$headers = "";
while ($str = trim(fgets($sock, 4096)))
$headers .= "$str\n";
print "\n";
$body = "";
while (!feof($sock))
$body .= fgets($sock, 4096);
fclose($sock);
Expected result:
----------------
variable "go" should contain "sent", but is not set in
d_content_kontakt.php
--
Edit bug report at http://bugs.php.net/?id=25693&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25693&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25693&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=25693&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=25693&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=25693&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=25693&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=25693&r=support
Expected behavior: http://bugs.php.net/fix.php?id=25693&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=25693&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=25693&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=25693&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25693&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=25693&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=25693&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=25693&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=25693&r=float