Mleha писал(а):Если ее под себя подогнать?
13GHOST писал(а):А что если попробывать через оф. сайты операторов: например Билайн: http://www.beeonline.ru/servlet/send/sms/ ?
Function SendBeeLineSMS(sPhonePrefix As String, sPhoneNumber As String, sMsg As String, Optional sErr As String) As Boolean
Dim lConn As Long, lReq As Long, lAns As Long, lErr As Long
Dim sHdr As String, sOpt As String, sBuff As String
On Error GoTo er
lConn = InternetConnect(lInet, "www.beeonline.ru", INTERNET_DEFAULT_HTTP_PORT, _
vbNullString, vbNullString, INTERNET_SERVICE_HTTP, INTERNET_FLAG_KEEP_CONNECTION Or _
INTERNET_FLAG_NO_CACHE_WRITE Or INTERNET_FLAG_RELOAD, 0)
If lConn = 0 Then Err.Raise clERROR, , "InternetConnect function error"
sHdr = "Content-Type: application/x-www-form-urlencoded"
sOpt = "phone=" & sPhoneNumber & "&number_sms=number_sms_send&prf=7" & sPhonePrefix & _
"&termtype=G&message=" & sMsg
lReq = HttpOpenRequest(lConn, "POST", "/servlet/send/sms/", "HTTP/1.0", vbNullString, 0, 0, 0)
re:
lAns = HttpSendRequest(lReq, sHdr, Len(sHdr), sOpt, Len(sOpt))
If lAns = 0 Then
lErr = IIf(lReq, ERROR_SUCCESS, GetLastError)
lErr = InternetErrorDlg(GetDesktopWindow, lReq, lErr, FLAGS_ERROR_UI_FILTER_FOR_ERRORS Or _
FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS Or FLAGS_ERROR_UI_FLAGS_GENERATE_DATA, 0)
If lErr = ERROR_INTERNET_FORCE_RETRY Then GoTo re
End If
If lAns = 0 Then Err.Raise clERROR, , "can't connect"
sBuff = Space(1024)
lErr = Len(sBuff)
HttpQueryInfo lReq, HTTP_QUERY_STATUS_CODE, sBuff, lErr, ByVal 0&
sBuff = Trim$(Left$(sBuff, 3))
If sBuff = CStr(HTTP_STATUS_DENIED) Or sBuff = CStr(HTTP_STATUS_PROXY_AUTH_REQ) Then _
Err.Raise clERROR, , "Access denied"
InternetCloseHandle lReq
SendBeeLineSMS = True
GoTo ok
er:
sErr = "Send SMS error: " & Err.Description
ok:
Err.Clear
End Function
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 51