Take the tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am fetching the data in JSON format from YouTube but it returns the JSON as gdata.io.handleScriptLoaded({key:value});

How I can access the key in php as the response is not JSON object

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

I have found the answer my self.

I was passing the value into request url script-in-json. simplay changed it to json

share|improve this answer
 
Rana's self-answer was the solution for me as well - I was using 'script-in-json' instead of simply 'json'. I needed to know what other formats/options were available. Thanks to Rana's answer I knew what the right thing to query with Google. developers.google.com/feed/v1/… –  ZocaloJesse Mar 24 at 14:53
add comment
$json = gdata.io.handleScriptLoaded({key:value});
    $res = json_decode($json);
    print $res->{'key'}; // it prints your value
share|improve this answer
 
Trying to get property of non-object –  Rana Muhammad Usman Dec 18 '12 at 13:32
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.