417 status/response code and PHP cURL

Friday May 15thPHP, Tutorial Category



Recently I have released an extension named put_twitter for PunBB 1.3.x. It sends forum’s activity to designated twitter account. It uses twitter class for posting to twitter which utilizes PHP’s cURL library.

The extension works fine for most of the people. But a few were complaining that it was not working for them! I was totally confused! Today while working with this script, I have tried to know the server’s response. I found that it was returning 417. This is first time in my life getting such response code! So I have started googling! After a long search I have found the solution.

When we prepare cURL request header, we need to add an extra line to get rid of this error. It is like:
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Expect:"));

No sooner I added it and uploaded, I found my problem fixed and all messages are not instantly posting to twitter.

More more info please visit this and this.

Bookmark: bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

No related posts.

3 Comments

  1. Arafat Rahman
    May 15, 2009

    Great works, keep it up.

  2. invarbrass
    May 20, 2009

    cURL or lighttpd is not at fault here. It’s the way the HTTP protocol was designed.

    To understand what the “Expect: 100- continue” header line does, please refer to RFC 2616:
    http://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html
    http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html

  3. Alwahsh
    October 9, 2009

    thanks for that

Leave a comment

curl http status 417 - CURLOPT "Expect: 100-continue" -

Size

Colors