I find that PHP is very unreliable when processing JSON. Rather than
even trying to fight this, I find it much more reliable to call the
Twitter API with a request for Atom format, which is really just XML.
Then I can use simplexml_load_string to get the result into a PHP
object. From there I can use a foreach loop to pull out the pieces and
store them in a MySQL database. I also find it easier to send it to
jQuery through Ajax as an HTML string, since I'm going to have to add
it to the page DOM as HTML anyway. In jQuery I use .get() to pull down
the HTML from the server.
up on using it with PHP. The PHP forums are filled with complaints
about JSON handling.
On Oct 28, 8:28 pm, Peter Denton <petermden...@gmail.com> wrote:
> We are working on a service dealing with a high volume of tweets. We are
> seeing crazy things coming through in tweets and are running into recurring
> issues when creating large JSON strings to pass to our parser.
> I am curious if anyone can share approach or methodology on how they are
> creating valid JSON via PHP.
> - We are storing the tweets as they are first in a DB
> - doing some processing
> - sending them back to the UI in various forms, via jQuery ajax calls
> 99% of the time, our server side encoding works great, but some tweets are
> just bizarre and valid JSON fails.
> Any advice helps.