HTTP PUT
| From: | Dieter Kneffel | Date: | Wed, 20 Sep 2000 18:08:01 +0000 |
| Subject: | HTTP PUT | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-17225@lists.php.net to get a copy of this message | ||
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.
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);
}
?>