PHP cURL error: “Empty reply from server”

后端 未结 5 1977
感情败类
感情败类 2020-12-29 14:50

I have a class function to interface with the RESTful API for Last.FM - its purpose is to grab the most recent tracks for my user. Here it is:

private stati         


        
5条回答
  •  一个人的身影
    2020-12-29 15:14

    The server received your request, but sent an empty response. Check the result of curl_getinfo($ch, CURLINFO_HTTP_CODE) to find out if the server responded with an HTTP error code.

    Update: Ok so the server responds with the 100 Continue HTTP status code. In that case, this should solve your problem:

    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
    

    I found this here: PHP and cURL: Disabling 100-continue header. Hope it works!

提交回复
热议问题