728x90 반응형 SMALL POST호출1 [PHP] POST로 다른 URL 호출하기 PHP 코드 내에서 다른 사이트의 API를 사용해야 하는 경우가 있어요. POST로 호출할 때 사용하면 돼요. $url = 'https://banjubu.com/api/get_some'; $data = ['foo1' => 'var1', 'foo2' => 'var2']; $options = [ 'http' => [ 'header' => "Content-type: application/x-www-form-urlencoded\r\n", 'method' => 'POST', 'content' => http_build_query($data), ] ]; $context = stream_context_create($options); $result = file_get_contents($url, false, $contex.. 2020. 9. 17. 이전 1 다음 728x90 반응형 LIST