PHP-General:HTTP PUT
| From: | Dieter Kneffel | Date: | Mon, 25 Sep 2000 02:27:06 +0000 |
| Subject: | PHP-General:HTTP PUT | ||
| Groups: | php.db php.general | ||
| Request: | Send a blank email to php-db+get-3075@lists.php.net to get a copy of this message | ||
Sorry to post it here, but as you've noticed, the main list
is down! Perhaps someone can just point me to the right
direction!
---------------------------------------------------------------------------
How to make a HTTP PUT request to a server in order
to send a file? What is the difference to e.g. a simulated
POST request? I have a server that accepts files by the
PUT method and need to upload files using a PHP script
to this server. Please help!
Thanks,
dk
-- see this unfinished example:
<?
// send a file using the PUT method
$my_file="... this is supposed to be the content of my file ... ";
$fp = fsockopen("my.server.com", 80, &$errno, &$errstr, 30);
if(!$fp) {
echo "$errstr ($errno)<br>\n";
} else {
fputs($fp,"PUT /path/to/file.xml HTTP/1.1\n");
//
// what do I have to send here? headers? filesize? ???
//
fputs($fp,$my_file);
fclose($fp);
}
?>