Created
March 2, 2017 08:16
-
-
Save g00cey/dfb7cc9a2e59e153442f93d526e914f1 to your computer and use it in GitHub Desktop.
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
<?php | |
$data = array( | |
'f&oo'=>'bar', | |
'baz'=>'bo/om', | |
'php'=>'hypertext processor' | |
); | |
$data = http_build_query($data, "", "&"); | |
//header | |
$header = array( | |
"Content-Type: application/x-www-form-urlencoded", | |
"Content-Length: ".strlen($data) | |
); | |
$context = array( | |
"http" => array( | |
"method" => "POST", | |
"header" => implode("\r\n", $header), | |
"content" => $data | |
) | |
); | |
echo 'request_body'; | |
var_dump($data); | |
echo file_get_contents('https://domain/magazine/Gushi/index', false, stream_context_create($context)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment