1. Is this the example code or code you typed out? Does the example code cause the same problem without any changes?
2. Double check the request is being made to the correct URL and that URL returns what you expect in the browser.
The problem is the posts are not being grabbed, but there are a few steps at which this problem could occur.