Currently, your code creates a small webpage. The webpage uses an HTML form
to send data to a website.
You can change the location and method of this data by editing the <form>
tag. Currently, it uses post
(as opposed to get
) and it doesn't have a destination url. If there is no destination, then it will send the data to itself. You can set a destination with the action
attribute, like this:
<form method="post" action="http://example.com/pagename">
Once you are done, view this page in a browser. You should see a single button. Once you click it, it will post the data to whatever action
is set to.
EDIT
It looks like you are trying to send a lot of data to this server. This might not work as intended with just an HTML form.
An alternate way to do this is to use cURL
. cURL
lets you create POST
data within the code of a PHP page. It might be more practical to take a large file (like a movie or something) and POST
it to your friend's server like this:
<?php
// Code from http://forums.devshed.com/php-development-5/php-curl-send-a-file-533233.html
// write the path to your file here:
$filename = 'C:/myenormousfile.avi';
// write the url to your friend's site here:
$url = 'http://example.com/filename';
$file_to_upload = array('file_contents'=>'@' . $filename);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $file_to_upload);
$result=curl_exec ($ch);
curl_close ($ch);
echo $result;
?>
Save this into a .php
file, and view the file through your localhost. If it works correctly, then it will attempt to POST
the file to your friend's site. It will then show text that indicates if the upload was successful or not.
EDIT #2
This might be a simpler approach. It is an HTML webpage, so the only thing you would need to do would be to save this code into a .html
file, and look at it in any browser: you wouldn't need to do anything with PHP
or web servers. This page will let you pick a file (again, you should use it to pick a large file), and POST it to your friend's website. The file can be up to ~4 GB in size. You can change the action
attribute of the <form>
element to send the file to a different location.
<!doctype html>
<html>
<head><title>Pick a File and POST it to your Friend's Server</title></head>
<body>
<form action="http://www.example.com/pagename" method="post" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="5000000" />
<input type="file" name="uploadField" />
<input type="submit" value="Go" />
</form>
</body>
</html>
Paste this into a file, save it as post.html
, then look at the file in Windows Explorer. Then right click on the file and open it with a browser. You should see a "Browse..." button and a button that says "Go". Use "Browse..." to pick an enormous file, then click "Go" and see what happens.