CorryWestSide
Member
hi i have this code in php that i wrote some month ago, my question is, can i write this in b4a?
the actual difficoult that i encounter is given by the file .crt and .key for the ssl. Someone can help me in some way?
the actual difficoult that i encounter is given by the file .crt and .key for the ssl. Someone can help me in some way?
My php code that i wanna convert:
function post_listaDispositivi() {
$body = trim(file_get_contents('php://input'));
$crt_path = "./Chiavi/" . $body . "/" . $body . ".crt";
$key_path = "./Chiavi/" . $body . "/" . $body . ".key";
//$crt_path = "./Chiavi/" . $body . "/" . $body . ".crt";
//$key_path = "./Chiavi/" . $body . "/" . $body . ".key";
if( !file_exists($crt_path) || !file_exists($key_path) ){
echo "-1";
return "-1";
}
$url = "https://apig-ivaservizi.agenziaentrate.gov.it/apig/v1/gestori/me/dispositivi/?perPage=500000";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_PORT , 443);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_SSLCERT, $crt_path);
curl_setopt(curl, CURLOPT_SSLCERTTYPE, "CRT");
curl_setopt($ch, CURLOPT_SSLKEY, $key_path);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if( strtoupper($method) == "POST" )
{
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
}
$response = curl_exec($ch);
$info =curl_errno($ch)>0 ? array("curl_error_".curl_errno($ch)=>curl_error($ch)) : curl_getinfo($ch);
print_r($response);
curl_close($ch);
return $response;
}