My code is as follow

I need to use this code to fetch data from web service and show them in a site properly but after I request for the webservice I am unable to load them fast. Site is loading very slow.

<?php

$jRequestURLPrefix = 'http://demo.4ds.com/rema/1.1/';

$menu_json_url = $jRequestURLPrefix."rules/origins/b2c.json";

$menu_data = get_json_data($menu_json_url);

/* Function get_json_data definition */

function get_json_data($json_url, $return_array = true, $print_array = false, $curl = true )
{
$jsonString = '';
$data = array();
if (!$curl)
{
/*
* if !$curl, use "file_get_contents" method
* to get JSON encoded string
*/
$jsonString = file_get_contents($json_url);

}
else
{
/*
* if $curl, use "curl" method
* to get JSON encoded string
*/

// Initializing curl
$ch = curl_init( $json_url );

// Configuring curl options
$options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array('Content-type: application/json') ,
);

// Setting curl options
curl_setopt_array( $ch, $options );

// Getting JSON encoded string
$jsonString = curl_exec($ch);
}


// convert the JSON encoded string into a PHP variable(array)
//if($return_array)
$data = json_decode($jsonString, $return_array);

// $print_array == true, print the array
if($print_array)
{
echo '<pre>';
print_r($data);
echo '</pre>';
}

return $data;

}

?>

After using the above procedure I am getting the response very slow. Can anyone please help If I need to change any steps here