1

This is my array. as you notice it has response because i use it on JSONP

How can get the value of the json using PHP?

this is my code :

      foreach ($apiResults['contacts'] as $contact=>$cs) {
          foreach ($apiResults['conference_participants'] as $conference_participant=>$c) {

            if ($c['name'] == $cs['name']) {
              unset($apiResults['contacts'][$contact]);
            }

          }
       }
3

1 Answer 1

1

I'm not yet able to write a comment, so i'll try to write it as an answer. json_decode will not return a value because your json string is containing callback function response() which is not a valid json string.

You'll need to remove the callback function name response( and the trailing ).

example:

$array = json_decode(substr( $jsonp, 8, -1 )); // $jsonp is your server jsonp response

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.