class
CcAction
extends
Action {
public
function
getjson(){
echo
json_encode(
$GLOBALS
[
'HTTP_RAW_POST_DATA'
]);
}
public
function
testcurl(){
$header
=
array
(
'Accept:application/json'
,
'Content-Type:application/json'
);
$patoken
=
array
(
'name'
=>
'phpjyz'
,
'age'
=>
'23'
,
);
$json_string
= json_encode(
$patoken
);
$ch
= curl_init();
curl_setopt(
$ch
, CURLOPT_CONNECTTIMEOUT, 60);
curl_setopt(
$ch
, CURLOPT_RETURNTRANSFER, 1);
curl_setopt(
$ch
, CURLOPT_POST, 1);
curl_setopt(
$ch
, CURLOPT_USERAGENT,
'SSTS Browser/1.0'
);
curl_setopt(
$ch
, CURLOPT_ENCODING,
'gzip'
);
curl_setopt(
$ch
, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt(
$ch
, CURLOPT_SSL_VERIFYHOST, 1);
curl_setopt(
$ch
, CURLOPT_URL,
'http://www.scutephp.com/api.php/cc/getjson'
);
curl_setopt(
$ch
, CURLOPT_POSTFIELDS,
$json_string
);
curl_setopt(
$ch
, CURLOPT_HTTPHEADER,
$header
);
$ret
= curl_exec(
$ch
);
print_r(json_decode(
$ret
, true));
}
}