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]);
            }

          }
       }
Agent69
  • 648
  • 1
  • 8
  • 16

1 Answers1

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

Aggie
  • 129
  • 4