WordPress 플러그인에서 PHP를 사용하여 http 요청을 만들고 싶습니다. 여기에 내 코드가 있습니다.
$request = wp_remote_post('https://en0ctqi09fhu7m.x.pipedream.net/', array(
'headers' => array('Accept' => 'application/json'),
'body' => array('data_type' => 'customer', )
));
하지만 본문에는이 데이터를 보내고 싶습니다
{
"data_type:": "customer",
"customer": {
"id": 123,
"first_name": "John",
"last_name": "Doe",
"email": "[email protected]",
"address": "18/XII, Light Avenue, Upper Manhattan, NY"
}
}
본문 섹션에서 데이터를 보내는 방법이 혼란 스럽습니다.
이 시도 :
$response = wp_remote_post( $url, array(
'method' => 'POST',
'headers' => array('Accept' => 'application/json'),
'timeout' => 45,
'redirection' => 5,
'httpversion' => '1.0',
'blocking' => true,
'body' => array(
'data_type' => 'customer',
'customer' => array(
"id" => 123,
"first_name" => "John",
"last_name" => "Doe",
"email" => "[email protected]",
"address" => "18/XII, Light Avenue, Upper Manhattan, NY"
)
)
));
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다