Reputation: 1
Is this possible within PHP:
Is it doable in PHP? Does PHP have inbuilt functions to perform the above tasks? Would such a thing require tons of advanced code or is it relatively easy to do?
Thanks in advance for any help on the matter
Upvotes: 0
Views: 1148
Reputation: 833
Yes, when you send your form, send it to the server you want with method of POST. Which would look like:
<form action="www.siteURL/pageToParseCode.php" method="post">
First name: <input type="text" name="fname" /><br />
Last name: <input type="text" name="lname" /><br />
<input type="submit" value="Submit" />
</form>
At the server its sent to you will want to do something like:
$field1 = $_POST['field1name'];
On the server which will manipulate the data, you can then post it back to your server using someting like curl, if you dont totally understand curl take a look at that link there, or you could use a php header, and set the data you want to send back into the url using a get method, so the url the user receives would look like this using the get method:
www.yoursite.com/index.php?variable1=value1&variable2=value2 and so forth, then interpret that like so:
if (isset($_GET['variable1'])) {
$var = $_GET['variable1'];
}
Upvotes: 0
Reputation: 2840
You can use cURL for that
$urltopost = "http://somewebsite.com/script.php";
$datatopost = $_POST; //This will be posted to the website, copy what has been posted to your website
$ch = curl_init ($urltopost);
curl_setopt ($ch, CURLOPT_POST, true);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $datatopost);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
$returndata = curl_exec ($ch); //This is the output the server sends back
Upvotes: 1