Without using a form, is it possible to _POST to a different file?
In my case, I want to send a string via _POST, to that file.
Thanks.
Update:
Based on a response to my post, I used this:
<?php
$ipCreation = $_SERVER['REMOTE_ADDR'];
$ipCreationCurl = curl_init(); // initiate curl
$url = "accountcreation.php"; // where you want to post data
curl_setopt($ipCreationCurl, CURLOPT_URL,$url);
curl_setopt($ipCreationCurl, CURLOPT_POST, true); // tell curl you want to post something
curl_setopt($ipCreationCurl, CURLOPT_POSTFIELDS, $ipCreation); // define what you want to post
curl_setopt($ipCreationCurl, CURLOPT_RETURNTRANSFER, true); // return the output in string format
$output = curl_exec ($ipCreationCurl); // execute
curl_close ($ipCreationCurl); // close curl handle
var_dump($output); // show output
?>
This returns:
"308 Moved Permanently"
What's my error? Thanks.
You can post using curl. Here is a basic example: http://devzone.co.in/post-data-using-curl-in-php-a-simple-example/
$ch = curl_init(); // initiate curl
$url = "http://www.somesite.com/curl_example.php"; // where you want to post data
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST, true); // tell curl you want to post something
curl_setopt($ch, CURLOPT_POSTFIELDS, "var1=value1&var2=value2&var_n=value_n"); // define what you want to post
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // return the output in string format
$output = curl_exec ($ch); // execute
curl_close ($ch); // close curl handle
var_dump($output); // show output