복붙노트

[WORDPRESS] wp_remote_post와 콘텐츠 형식을 설정합니다

WORDPRESS

wp_remote_post와 콘텐츠 형식을 설정합니다

해결법


  1. 1.당신이 원격 요청과 함께 무엇을 할 수 있는지에 대한 몇 가지 추가 정보를 제공합니다 wp_remote_post에 대한 설명서를 참조하십시오.

    당신이 원격 요청과 함께 무엇을 할 수 있는지에 대한 몇 가지 추가 정보를 제공합니다 wp_remote_post에 대한 설명서를 참조하십시오.

    그 기능을 사용하여 요청을 할 때, 어레이 내의 두번째 파라미터 헤더 ($ 인수)를 설정할 수있다. 예를 들면 :

    $args = array(
        'headers' => array(
            'content-type' => 'application/json'
        ),
    );
    
    $request = wp_remote_post( $url, $args );
    
  2. from https://stackoverflow.com/questions/50951072/set-the-content-type-with-wp-remote-post by cc-by-sa and MIT license