Last active
November 25, 2017 10:38
-
-
Save max-pub/5d0cb5a0272607f274b0 to your computer and use it in GitHub Desktop.
PHP POST
This file contains 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 post($url, $data){ | |
$options = array( | |
'http' => array( // use key 'http' even if you send the request to https://... | |
'header' => "Content-type: application/x-www-form-urlencoded\r\n", | |
'method' => 'POST', | |
'content' => http_build_query($data), | |
// 'content' => json_encode($data), | |
), | |
); | |
$context = stream_context_create($options); | |
return file_get_contents($url, false, $context); | |
} | |
?> |
Author
max-pub
commented
Feb 2, 2016
- a
- b
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment