php
curl 없이 post 데이터 주고 받기
┌(  ̄∇ ̄)┘™
2016. 5. 31. 12:27
728x90
[원문] http://stackoverflow.com/questions/8596311/how-to-make-a-post-request-without-curl
$postdata = http_build_query(
array(
'var1' => 'some content',
'var2' => 'doh'
)
);
$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('http://example.com/submit.php', false, $context);
728x90