<?php
$url = "http://localhost:8000"
$headers = array(
"data1: test1",
"data2: test2",
"data3: test3"
);
$ch = curl_init();
$curl_setopt($ch, CURLOPT_URL, $url);
$curl_setopt($ch, CURLOPT_HEADER, true);
$curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$curl_setopt($ch, CURLOPT_RETURNTRANSFER, ture);
$result = curl_exec ($ch);
?>
반응형
'PHP' 카테고리의 다른 글
[PHP] CURL를 통해 POST 형식으로 body 전송 - JSON 형태로 전송 (0) | 2021.08.06 |
---|---|
[PHP] 제너레이터(Generator) - yield, yield from (0) | 2020.09.06 |
[PHP] @(골뱅이) 의미 (0) | 2020.09.06 |
[PHP] 연산자 우선순위 (0) | 2020.09.06 |
[PHP] 유형 연산자 - instacnof (0) | 2020.09.06 |