The other thing.. the header will redirect and the rest won't happen???

> header ( 'Location: ../test/test.php' );

Just out of interest sake do you or not have register global on/off??



Timothy Hitchens (HITCHO)
[EMAIL PROTECTED]

HITCHO has Spoken!






-----Original Message-----
From: Pablo Oliva [mailto:[EMAIL PROTECTED]] 
Sent: Saturday, 5 October 2002 7:03 PM
To: [EMAIL PROTECTED]
Subject: [PHP] post(ing) data without a form


OK, I'm attempting this again:

header ( 'Location: ../test/test.php' );
sendByPost();
function sendByPost()
{
 $host = "localhost";
   $port = 80;
   $postdata = "field1=value1&field2=value2&field3=value3";
   if ($sp = fsockopen($host, $port)) {
     fputs($sp,"POST /jotr/test/test.php HTTP/1.0\n");
     fputs($sp,"Host: $host\n");
     fputs($sp,"Content-type: application/x-www-form-urlencoded\n");
     fputs($sp,"Content-length: ".strlen($postdata)."\n");
     fputs($sp,"Connection: close\n\n");
     fputs($sp,$postdata);
     fclose($sp);
   }
}

Pretty straight forward.  Now here's the code for test.php: $temp1 =
$_POST['field1']; $temp2 = $_POST['field2']; $temp3 = $_POST['field3'];
print $temp1.' '.$temp2.' '.$temp3;

But the data is not posting:
Notice: Undefined index: field1 in c:\apache\htdocs\jotr\test\test.php
on line 3
Notice: Undefined index: field2 in c:\apache\htdocs\jotr\test\test.php
on line 4
Notice: Undefined index: field3 in c:\apache\htdocs\jotr\test\test.php
on line 5

WTF is going on, shouldn't this work?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to