Lib Curl, Twitter API & “Expect: 100-continue” PAIN and How To Fix it

*this post will probably not be worthwhile for 99% of the normal readers. But for those having the same issue it will be priceless.*

I have been working on a new twitter app for a couple months and at approximately 5pm on December 23rd 2008 (3 days ago) it all went boom.

All of my php curl (lib curl) requests started returning:

HTTP/1.1 417 Expectation Failed

and the exact html returned is:

<title>417 Expectation Failed</title>
<h1>Expectation Failed</h1>
<p>The expectation given in the Expect request-header
field could not be met by this server.</p>
<p>The client sent<pre>
Expect: 100-continue
but we only allow the 100-continue expectation.</p>

It appears Twitter started being super anal about requests being sent and in particular the http/1.1 RFC post requests.

Anyway it took be a long time searching the web and trying various things until I figured out the solution by looking at some of the lib curl compilation files.

Just add:

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

and you will be fixed!

About The Author

Comments 73

  1. jtGraphic
    • meethere
      • jtGraphic
  2. Steven-Sanders
    • The Poker Jerk
  3. Internet Marketing Access
  4. Brennan
    • Taris Janitens
      • SEO Tips South Africa
  5. Internet Marketing Industry
  6. Jason
  7. Day
  8. Taris Janitens
  9. Mark
  10. Affiliate Showdown
  11. Wesley
  12. Blog And Make Cash
  13. Work At Home
  14. Hyder
  15. Learn English Online
  16. Owen
  17. Joe Tech
  18. Kyle Irwin
  19. RockaFeller
  20. Juuso
  21. Dick
  22. Typhoon
  23. Typhoon
  24. Typhoon
  25. memory
  26. iskandarX
  27. Karl hadwen
  28. Karl hadwen
  29. Dick
  30. BusinessX
  31. Dick
  32. Dick
  33. Personal Development Tips
  34. Drew
  35. Mike Peters
  36. Derek P. Collins
  37. JumpByte
  38. Rodney Joyce
  39. alex
  40. mystral-kk
  41. Al Becs
  42. danish
  43. blackwinged
  44. dnuske
  45. matthew
  46. Jeans
  47. Symphony
  48. Naval
  49. Billy Ellison
  50. Hannes
  51. mariochampion
  52. Zx.MYS
  53. Electric Guitars
  54. Kenton Monasterio
  55. Rosenda Lenoch
  56. shiju
  57. Sankha
  58. Ravi
  59. ear hearing loss
  60. Wesley
  61. Abel Perez
Weapons Of Marketing
My Legal Issues & Downloadable Resources
ACT Affiliate Marketing Method & Download
FaceBook Ninja Marketing Presentation
Interviewing Darren Rowse Of Problogger
Sarah East From PopCrunch – *NSFW* – Most Awkward Interview Ever
I Spill it All To Andrew Warner
Interviewing Penn Jillette @ TC 50
How To Be Successful Making Money Online (keynote)
NamesCon Keynote Talk (Domain Name Focused)
Affiliate Summit 2012 Closing Keynote With Slides
FaceBook Ninja Marketing Presentation