A place to log my programming solutions.
31
Dec '08

PHP HTTP Class 2

Revisiting the topic of my previous post, I’ve played around some more with this PHP HTTP Class. This morning, I’ve figured out how to send files over HTTP (actually HTTPS, but it works the same way). If you’ve looked through the author’s test scripts, you see that for file uploads, the provided example is:

$arguments["PostFiles"] = array(
	"userfile" => array(
		"Data" => "This is just a plain text attachment file.",
		"Name" => "attachment.txt",
		"Content-Type" => "automatic/name",
	),
	"anotherfile" => array(
		"FileName" => "test_http_post.php",
		"Content-Type" => "automatic/name",
	)
);

So it’s actually pretty easy to send files. This class provides two methods, as we’ve seen in the example.

  • userfile: The first example sends raw data and provides a filename
  • anotherfile: The second example sends the file specified in FileName

Happy uploading!

Leave a Response

About NVNCBL

Contact Me