View Full Version : Json request
nagrgk
02-03-2010, 05:14 AM
external url having content in {string:value} format
how do i get it and display using php?
Context? Something like http://externaldomain.com/feed.json?
If you truly want to handle this with PHP, grab the data using the cURL (http://www.php.net/curl) extension and from there you can parse the string, pass to an Ajax request, etc.
rnd me
02-03-2010, 09:32 PM
external url having content in {string:value} format
how do i get it and display using php?
youll have to parse it yourself if it's not JSON (the example ain't).
If it's JSON, you can use php's json_decode().
ahallicks
02-09-2010, 11:53 AM
youll have to parse it yourself if it's not JSON (the example ain't).
If it's JSON, you can use php's json_decode().
Tho be careful because the json_decode() function is only available in PHP >= 5.3. If you are using an older version there is a nice script that works for older version:
This might help (http://willshouse.com/2009/06/12/using-json_encode-and-json_decode-in-php4/)
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.