Last active
January 22, 2018 03:30
-
-
Save icuy/595d5d3219f665f0b44242e46dc984bf to your computer and use it in GitHub Desktop.
Create POST request
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function postRequest($postdata,$url) | |
| { | |
| $postdata = http_build_query($postdata); | |
| $opts = array('http' => | |
| array( | |
| 'method' => 'POST', | |
| 'header' => 'Content-type: application/x-www-form-urlencoded', | |
| 'content' => $postdata | |
| ) | |
| ); | |
| $context = stream_context_create($opts); | |
| $result = file_get_contents($url, false, $context); | |
| } | |
| $url = 'http://0oor.com/'; | |
| $postdata = array('key' => 'value'); | |
| postRequest($postdata,$url); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment