I have setup CiViCRM in one Drupal site, and then from another Drupal site I'm fetching events from that first site. This entire thing is working fine in my local.
Now I have uploaded both sites on staging server. On one site, I have install CiViCRM from scratch (no relation with local CiViCRM) and new CiVi installation is completed successfully without any errors. But when I'm trying to fetch events using API, I'm getting this error:
Unable to parse returned JSON
All configuration is perfect e.i API key, site key and CiVi server.
Below is my code to fetch events using API.
$api = new civicrm_api3 (array ('server' => 'http://xxxxxxx.com', 'api_key'=> 'abc123456', 'key'=> 'd0d792e6cd3c824bb3e0b671992fdc2d'));
if ($api->Event->Get()) {
print_r($api);
} else {
echo $api->errorMsg();
}
PS: I don't think there can be any issue in code, as same code is working fine on local.
Any help would be appreciated.