excel-92457
asked on
UTL_HTTP
I am trying to send SMS using HTTP posting method but getting the error message "The parameter is incorrect", I am trying to do it using Oracle 8i. Thanks
Likely UTL_HTTP is the correct package, as most web based SMS gateways (not SMTP) expose a HTTP based service.
Provide your code so we can see it?
Provide your code so we can see it?
ASKER
Dear Sadler,
I have used UTL_SMTP for the same purpose but now we have changed the SMS provider and he does not support email to SMS so we have to change the process by shifting to HTTP post method that's why I am trying to use this package. Here is code which I am using for this purpose. If I send request for www.google.come it returns the page successfully.
DECALRE
text_str varchar2(5000);
text_sms varchar2(2000) := 'http://www.kaamilsms.com/kaamil/custapi/sendTextSMS_http.cfm?usrName=xx&usrPass=xx&msgLNG=eng&msgSenderID=xx&gsmNumber=966509418646&msgtext=This is a test english message';
begin
text_str := utl_http.request(text_sms) ;
end;
/
Thanks and regards
I have used UTL_SMTP for the same purpose but now we have changed the SMS provider and he does not support email to SMS so we have to change the process by shifting to HTTP post method that's why I am trying to use this package. Here is code which I am using for this purpose. If I send request for www.google.come it returns the page successfully.
DECALRE
text_str varchar2(5000);
text_sms varchar2(2000) := 'http://www.kaamilsms.com/kaamil/custapi/sendTextSMS_http.cfm?usrName=xx&usrPass=xx&msgLNG=eng&msgSenderID=xx&gsmNumber=966509418646&msgtext=This is a test english message';
begin
text_str := utl_http.request(text_sms)
end;
/
Thanks and regards
Well, the UTL_HTTP package seems to be working for you. I believe Kaamil is trying to tell you that the parameter value you're sending to them is not formed correctly. Perhaps one or more of your variable values is blank?
You should URL encode the string before sending. Otherwise, I think UTL_HTTP.REQUEST will do I am not sure what, such as remove the spaces. It is possible you having problems related to proper encoding.
select utl_url.escape('http://foo.com/api?arg=this is a test') from dual;
text_str := utl_http.request(utl_url.e scape('http://foo.com/api?arg=this is a test'));
select utl_url.escape('http://foo.com/api?arg=this is a test') from dual;
text_str := utl_http.request(utl_url.e
ASKER
I figured out that any special character which is part of the SMS message cause this error.
Is this utl_url package available in 8i?
Thanks a lot for the help.
Is this utl_url package available in 8i?
Thanks a lot for the help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
DECLARE
c utl_smtp.connection;
PROCEDURE header(name IN VARCHAR2, header IN VARCHAR2) AS
BEGIN
utl_smtp.write_data(c, name || ': ' || header || utl_tcp.CRLF);
END;
BEGIN
c := utl_smtp.open_connection('
utl_smtp.helo(c, 'mailserver name');
utl_smtp.mail(c, 'email address');
utl_smtp.rcpt(c, '<phone_number@mobile_prov
utl_smtp.open_data(c);
header('From', '"Sender" <email address>');
header('To', '"Recipient" <phone_number@mobile_provi
header('Subject', 'Hello');
utl_smtp.write_data(c, utl_tcp.crlf || 'Hello,' || utl_tcp.CRLF || utl_tcp.CRLF || 'This is a test message.');
utl_smtp.close_data(c);
utl_smtp.quit(c);
END;
/