I have created a form custom module for get data from an external url.
$requestType = drupal_http_request('http://www.example.in/php/example/getSampleType.php',$options);
$loomType =drupal_json_decode($requestType->data);
Using this result I have created checkboxes and select a value from checkbox then submit the data.
function myForm_form_submit($form, &$form_state) {
$form_state['rebuild'] = TRUE;
$url='http://www.example.in/php/example/exampleSort.php';
//$data1 = http_build_query($form_state['values']['check'], '', '&');
$checked = array();
foreach($form_state['values']['check'] as $key => $val) {
array_push($checked, $val);
}
$mychecked=checking($checked);
$checkedType = array();
foreach($form_state['values']['checktype'] as $key => $val) {
array_push($checkedType, $val);
}
$loomType=checking($checkedType);
$datas=array("sampleMachine"=>$mychecked, "sampleType"=> $loomType);
$data =json_encode($datas);
$option = array(
'method' => 'POST',
'data' => $data,
'headers' => array('Content-Type' => 'application/json'),
);
//$headers = array('Content-Type' => 'application/json');
$response =drupal_http_request($url,$option);
echo "<pre>";
print_r($response);
echo "</pre>";
}
I got some result. Now I want to display those results in my drupal page. How can I do that..I am using Drupal 7.