Allowed Values in Drupal I am using Drupal-6. I Created CCK Field with Select Box with content type name as list_porducts. 

i am  fetching products from external url . Here is my code 

$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);
return $res;


which is running properly. Now Problem is this is Quite slow. and i guess it is running for all page load. 

Any Idea how to do this.

Thanks
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.