Reputation: 307
I'd like to use PHP to post to a URL the way a form would. Basically the same function that this form would do
<form method="POST" id="foo" action="<?php echo $url; ?>">
<input type="hidden" name="shopId" value="<?php echo $ID; ?>">
<input type="hidden" name="encodedMessage" value="<?php echo $encodedMessage; ?>">
<input type="hidden" name="signature" value="<?php echo $signature; ?>">
<input type="submit" value="Submit" name="buy">
</form></div>
How can I do this?
Upvotes: 1
Views: 193
Reputation: 1132
There's several ways to do this, but the easiest is probably with file_get_contents() and stream_context_create(). See this file_get_contents() comment for an example.
Upvotes: 0