View Single Post
Old 06-21-2009, 09:13 AM   #8 (permalink)
Quiet
The Visitor
 
Join Date: Jun 2009
Posts: 1
Thanks: 0
Quiet is on a distinguished road
Help Having trouble Decoding a JSON Response

I'm trying to decode the following response from su.pr:

Code:
{"errorCode":0,"errorMessage":"","results":{"http:\/\/www.stumbleupon.com":{"hash":"1nlKX2","shortUrl":"http:\/\/su.pr\/1nlKX2"}},"statusCode":"OK"}
I am basically looking to pull the value of "hash" and use it as a PHP variable.

This is what I have so far, but I keep getting a null result:

Code:
$json = json_decode($jsonresponse, true);
$hash = $json['hash'];
I also attempted to add stripslashes, in case it had to do with magic quotes being on. (Which i don't think is.)

Any help would be appreciated!
Quiet is offline  
Reply With Quote