JSON数据:
{"FORM_ID":51393,
"ORG_ID":1527,
"REQUEST_ACTION":"ADD",
"ADD_DATA":
{
"RECORDS":
[
{
"ID":"0",
"COLUMNS":
[
{"NAME":"App Status", "VALUE":"Pending"},
{"NAME":"Remarks","VALUE":"Application in Pending"},
{"NAME":"App Date (dd/MMM/yyyy)" ,"VALUE":"2017-29-03 00:00:00.0"},
{"NAME":"Applicant First Name", "VALUE":"TEST WEBSERVICES First"},
{"NAME":"Applicant Middle Name", "VALUE":"TEST WEBSERVICES Second"},
{"NAME":"Applicant Last Name", "VALUE":"TEST WEBSERVICES Last"},
{"NAME":"Enquiry Center - Walk", "VALUE":"Telephonic"},
{"NAME":"Admission City Office", "VALUE":"TestCity"},
{"NAME":"Applicant Email Id", "VALUE":"test@test.com"},
{"NAME":"Nationality", "VALUE":"testNationality"},
{"NAME":"Country", "VALUE":"INDIA"},
{"NAME":"State", "VALUE":"MAHARASTRA"},
{"NAME":"City", "VALUE":"Mumbai"},
{"NAME":"Permanent Country", "VALUE":"INDIA"},
{"NAME":"Application Seq No", "VALUE":""}
{"NAME":"Application Seq No", "Mobile No":"9999999999"}
]
}
]
}
}
答案 0 :(得分:0)
我不知道你想做什么,但如果你有阵列
echo json_encode($array);
如果你试图从网址获取它
function curl_download($Url){
// is cURL installed yet?
if (!function_exists('curl_init')){
die('Sorry cURL is not installed!');
}
// OK cool - then let's create a new cURL resource handle
$ch = curl_init();
// Now set some options (most are optional)
// Set URL to download
curl_setopt($ch, CURLOPT_URL, $Url);
// Set a referer
curl_setopt($ch, CURLOPT_REFERER, "http://www.example.org/yay.htm");
// User agent
curl_setopt($ch, CURLOPT_USERAGENT, "MozillaXYZ/1.0");
// Include header in result? (0 = yes, 1 = no)
curl_setopt($ch, CURLOPT_HEADER, 0);
// Should cURL return or print out the data? (true = return, false = print)
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Timeout in seconds
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
// Download the given URL, and return output
$output = curl_exec($ch);
// Close the cURL resource, and free system resources
curl_close($ch);
return $output;
}
echo json_encode(curl_download("http://url.com")) ;