Allowed Values in Drupal
Store the result into a session like below

function get_all_products() {
  $prod = get_products();
}

function get_products($reset = FALSE) {
  $res = $_SESSION['products'];
  if(empty($res) || $reset) {
    $key=array();
    $flowervalue=array();
    for($i=2;$i&lt;=150; $i++) {
            $url="http://testurl.com/test/node/".$i.".jsonp";
            $timeout=0;
            $ch = curl_init();
            curl_setopt($ch,CURLOPT_URL,$url);
            curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
            curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
            $data = curl_exec($ch);
            $jdata=json_decode($data);  

                if($jdata-&gt;type=='product') {
                    $key[]=$jdata-&gt;nid;
                    $flowervalue[]=$jdata-&gt;title." ".$jdata-&gt;field_petals_code[0]-&gt;value;



                }   



    }
    $res=array_combine($key, $flowervalue);
    $_SESSION['products'] = $res;
  }
  return $res;
}


Else if you want cache the  $url="http://testurl.com/test/node/".$i.".jsonp" enable the page caching in drupal.