How to send a header using a HTTP request through a curl call?

后端 未结 10 1307
梦如初夏
梦如初夏 2020-11-22 16:45

I wish to send a header to my Apache server on a Linux box. How can I achieve this via a curl call?

10条回答
  •  有刺的猬
    2020-11-22 17:23

    In PHP:

    curl_setopt($ch, CURLOPT_HTTPHEADER, array('HeaderName:HeaderValue'));
    

    or you can set multiple:

    curl_setopt($ch, CURLOPT_HTTPHEADER, array('HeaderName:HeaderValue', 'HeaderName2:HeaderValue2'));
    

提交回复
热议问题