Reputation: 6306
how I SEND stuff with PHP and POST? (not how to grab, or how to send from html... but how to send from PHP... the particular PHP script is not even running in a webserver, neither is part of a web-page).
I looked everywhere on google, but I keep finding examples of how to use a html form, and how to use $_POST to get the results...
Upvotes: 0
Views: 112
Reputation: 11325
You can use libcurl for that. http://php.net/manual/en/book.curl.php
<?php
$ch = curl_init();
$data = array('name' => 'Foo', 'file' => '@/home/user/test.png');
curl_setopt($ch, CURLOPT_URL, 'http://localhost/upload.php');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_exec($ch);
curl_close($ch);
?>
Upvotes: 7