Thanks,
Alex
No virus found in this outgoing message. Scanned by AVG Free 8.0
Checked by AVG - http://www.avg.com
Version: 8.0.138 / Virus Database: 270.4.7/1544 - Release Date: 10/07/2008
07:37
Two methods:
1. Use the query string. Eg
header('Location: http://www.xxx.com?name=value&name2=value2');
2. Use sessions
--
Richard Heyes
Employ me:
http://www.phpguru.org/cv
That's GET, not POST, as the subject requests. ;-P
> 2. Use sessions
.... if you're not trying to POST the data and are staying within
the same domain on the same server. ;-P
--
</Daniel P. Brown>
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.
You probably want to use cURL:
I'm pretty sure he means persist POST data on the forwarded request.
With all that in mind, if you must POST then you can do something like this:
$data = addslashes("yourvar=$yourdata&secondvar=$moredata"); //just like get
header('POST /some/path/to/somefile.php HTTP/1.1');
header('Host: www.example.com');
header("Content-Type: application/x-www-form-urlencoded");
header("Content-Length: " . strlen($data));
header($data);
-Shawn
Have you tried it? I very much doubt that would work, considering
neither GET nor POST are valid in a RESPONSE (which is what you're
sending), they're only valid in REQUEST headers (which you're not in
right now, that's the browser's domain)
Right, the user's *browser* has to send the request. So return a
hidden form that submits with Javascript:
<form action='url' method='post'><div>
<?php foreach($data as $key => $val): ?>
<input type='hidden'
name='<?php echo htmlspecialchars($key, ENT_QUOTES); ?>'
value='<?php echo htmlspecialchars($val, ENT_QUOTES); ?>' />
<?php endforeach; ?>
<input type='submit' name='__ignoreMe' value='Click to continue...' />
</div></form>
<script type='text/javascript'>
window.onload = function () { document.forms[0].submit(); };
</script>
Steve
Alext:
Or you could just:
ob_clean();
include('theNextScript.php');
exit();
The variable in your parent script will be "passed" to the next script.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
At the moment, I am just using a query string. How long is the limit of the
query string??
Alex
> No virus found in this incoming message.
> Checked by AVG - http://www.avg.com
> Version: 8.0.138 / Virus Database: 270.4.7/1546 - Release Date:
> 11/07/2008 06:47
No virus found in this outgoing message. Scanned by AVG Free 8.0
Checked by AVG - http://www.avg.com
Version: 8.0.138 / Virus Database: 270.4.7/1546 - Release Date: 11/07/2008
06:47
No virus found in this outgoing message. Scanned by AVG Free 8.0
Checked by AVG - http://www.avg.com
Version: 8.0.138 / Virus Database: 270.4.7/1546 - Release Date: 11/07/2008
06:47
That's why I mentioned cURL at the very beginning, if it had to be
done as a POST request.
> At the moment, I am just using a query string. How long is the limit of the
> query string??
There is no official limit in the protocol, but you may want to
check out Section 3.2.1 of RFC 2068 for more on that.
The limits are in what the client is capable of sending, and what
the server is capable of receiving. A quick S of TFW should give you
the information you need regarding PHP and the remote server's
configuration.
Incidentally, I did some minor testing on this a few years ago and
found the lengths vary greatly between servers.
.... and browsers. If I remember correctly, on Winblows alone,
Opera is capable of somewhere in the 4,500 character range, while
Internet Exploder is only capable of 2048+slack (2083 bytes). And
pre-1.0 HTTP days, it was common for many servers not to accept more
than 255 characters on GET.
Yes, those are generally the numbers I found as well.
In my more current test, I had one test that exceeded 5000
characters, but most were in the 2000 character range.
So what it boils down to is, you can send a respectable number of
characters via a GET, but if it's going to be in the 1K range, it's
best to test (it's best to test anyway).