Hola, es posible realizar esta conexion con xharbour ?,
String mensaje = "Mensaje de prueba";
String numero = "5551234567";
String api = "TU APIKEY AQUI";
String urlRequest="https://api.smsmasivos.com.mx/v1/sms/send";
String urlParametros = "apikey=" + URLEncoder.encode(api, "UTF-8") +
"&mensaje=" + URLEncoder.encode(mensaje, "UTF-8") +
"&numcelular=" + URLEncoder.encode(numero, "UTF-8") +
"&numregion=" + URLEncoder.encode("52", "UTF-8");
URL url;
HttpsURLConnection conexion = null;
try {
//-----------------------CREAR CONEXION----------------------------
url = new URL(urlRequest);
conexion = (HttpsURLConnection)url.openConnection();
conexion.addRequestProperty("User-Agent", "");
conexion.setRequestMethod("GET");
conexion.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
conexion.setRequestProperty("Content-Length", ", " + Integer.toString(urlParametros.getBytes().length));
conexion.setRequestProperty("Content-Language", "en-US");
conexion.setUseCaches (false);
conexion.setDoInput(true);
conexion.setDoOutput(true);
//-----------------------------------------------------------------
//--------------------ENVIAR PETICION------------------------------
DataOutputStream wr = new DataOutputStream ( conexion.getOutputStream() );
wr.writeBytes(urlParametros);
wr.flush();
wr.close();
//-----------------------------------------------------------------
//-----------------------OBTENER RESPUESTA-------------------------
InputStream is = conexion.getInputStream();
BufferedReader rd = new BufferedReader(new InputStreamReader(is,"UTF-8"));
String line;
StringBuffer responsee = new StringBuffer();
while((line = rd.readLine()) != null) {
responsee.append(line);
responsee.append('\r');
}
rd.close();
String respuesta = responsee.toString();
//-----------------------------------------------------------------
//-------------Decodificar JSON con libreria org.json--------------
JSONObject jsonObject = new JSONObject(respuesta);
if(jsonObject.getString("estatus").equals("ok")){
out.print(jsonObject.getString("mensaje")+"");
out.print("Referencia: "+jsonObject.getString("referencia")+"");
}else{
out.print(jsonObject.getString("mensaje")+"");
out.print("Codigo error: "+jsonObject.getString("codigo")+"");
}
//-----------------------------------------------------------------
}catch (Exception e) {
out.print(e);
}finally {
if(conexion != null) conexion.disconnect();
}