curl-and-php
send binary string directly without tmp. file
Date: Thu, 10 Oct 2002 13:25:15 +0200
Hi!
In my PHP-script I have got a binarystring(gzip). Is it possible to send
it directly?
My Script:
$file = "c:/www/test.gz";
$fp = fopen($file, "w");
fputs($fp, $binary_string);
fclose($fp);
$formvars["upfile"] = "@$file";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://server.de/test.php");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $formvars);
$result = curl_exec ($ch);
curl_close ($ch);
It works this way, but is it possible to send the binarystring without
writing it into test.gz before?
And one other question, why does php_curl transmit the fill path ([name]
=> c:/www/test.gz) and not just the filename(test.gz)?
[_FILES] => Array
(
[upfile] => Array
(
[name] => c:/www/test.txt
[type] => text/plain
[tmp_name] => /tmp/phpmpC67k
[size] => 2675
)
)
Regards
Andreas
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2002-10-10