I am working on building a rudimentary service which uses cURL to access some JSON-formatted data. From a php script I use cURL to make a request to a URL which is just a PHP script that outputs a JSON string via json_encode()-ing of an array of associative arrays (from database results). Visiting the page in the browser shows that the output is working:

[{"label":"Fun Fact","bits":"Did you know that the name \\"Floppy Deuce\\" is actually based on a handshake? True Story."},{"label":"Did You Know","bits":"Floppy Deuce offers competitive pricing for printing services. Moral of the story: If you need 300 bobblehead dolls that look like Gary Busey, we got you covered."},{"label":"F2 History","bits":"Floppy Deuce Co-Founder Chris Smola was a high school mathematics teacher for four years before becoming a full-time web developer. His new job is way more fun."}]

However, printing the curl_exec() data shows that only the first object in the array of objects has been returned:

[{"label":"Fun Fact","bits":"Did you know that the name \\"Floppy Deuce\\" is actually based on a handshake? True Story."}]

I have tried setting some of the cURL options as well as altering the cache and content-type headers in the output script, but nothing seems to work. I would prefer not to change to xml as it is more cumbersome to work with in PHP... =[

I'm sure I'm missing something blatantly obvious. Here is the curl code as it is now:

If your using a relatively modern version of PHP, you can try and do it without cURL and see what that shows up

Got the same result. Running 5.2.x =[

Smola
—
2011-02-01T03:24:55Z —
#5

Force flow, are all of the functions within your function native to php?

SimonJ621
—
2011-02-01T03:51:24Z —
#6

To debug, look into tcp mon (https://tcpmon.dev.java.net/). You can either download the client or just use the web client. It will detail you the header exchange. Pos both the request and response headers so we can take a look. If you have issues getting tcp mon setup, just let me know and I'll help trouble shoot.

Smola
—
2011-02-01T04:57:29Z —
#7

This is embarassing. :goof:

I felt I should take the time to resolve the situation even though I feel like the BIGGEST idiot right now. :injured:

swallows pride

I just started testing more locally as opposed to uploading saves to the server every 10 seconds. So, naturally, I've been working with my local MySQL database...yea...the URL I was requesting data from was the server URL. I hadn't synced the databases before testing.

Sorry everyone! Thanks though to SimonJ for pointing me to towards software with which the ensuing problems triggered the solution. :x

force
—
2011-02-01T18:43:30Z —
#8

Smola said:

Force flow, are all of the functions within your function native to php?