"value") // GET Params with resource id: user_api_key, account_api_key, offset, limit // GET Params without resource id: user_api_key, account_api_key function CallAPI($method, $url, $data = false, $json=false) { $curl = curl_init(); if ($data) { if ($json) { $data = json_encode($data); } else { $data = http_build_query($data); } } switch ($method) { case "POST": curl_setopt($curl, CURLOPT_POST, 1); if ($data) { curl_setopt($curl, CURLOPT_POSTFIELDS, $data); } break; case "PUT": curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT"); curl_setopt($curl, CURLOPT_POSTFIELDS, $data); break; case "DELETE": curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE"); if ($data) { curl_setopt($curl, CURLOPT_POSTFIELDS, $data); } break; case "GET": curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "GET"); if ($data) { curl_setopt($curl, CURLOPT_POSTFIELDS, $data); } break; default: curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method); if ($data) { curl_setopt($curl, CURLOPT_POSTFIELDS, $data); } } if ($json) { curl_setopt($curl, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'Content-Length: ' . strlen($data) ) ); } curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $x = curl_exec($curl); return $x; } /** * Where a resource ID is not specified, i.e., /pieces or /collections, * the default offset is 0 and limit is 25. * Maximum limit is set to 100. */ $data = array( 'user_api_key' => 'XXXXXXXXX', 'account_api_key' => 'XXXXXXXXXXXX', //'offset' => 0, //'limit' => 50 ); $apiResult = CallAPI('GET', 'api.vesica.ws/pieces', $data); //var_dump($apiResult); echo '
';
    print_r(json_decode($apiResult));
echo '
';