c++ sms send dll
-
i have a code for sms send my api provider is changed below mention is my code problem is what will return my new api vender so i can use that dll in my vfp application. code
// smsservice.cpp : Defines the exported functions for the DLL application.
//#include "stdafx.h"
#include "smsservice.h"
#include using namespace std;
size_t WriteFunction( char *ptr, size_t size, size_t nmemb, void *userdata)
{
string* s=(string*)userdata;
int i;
for(i=0;ipush_back(ptr[i]);
}
return i;
}
int _declspec(dllexport) SendSms(LPCSTR userId,LPCSTR userPass,LPCSTR phoneNumber,LPCSTR smsText,LPCSTR senderId)
{
CURL* curl;
curl=curl_easy_init();
string ret;
string url="http://way2send.in/submitsms.jsp?Userid=";char\* esc=curl\_easy\_escape(curl,userId,strlen(userId)); url+=esc; curl\_free(esc); url+="&UserPassword="; esc=curl\_easy\_escape(curl,userPass,strlen(userPass)); url+=esc; curl\_free(esc); url+="&PhoneNumber="; esc=curl\_easy\_escape(curl,phoneNumber,strlen(phoneNumber)); url+=esc; curl\_free(esc); url+="&Text="; esc=curl\_easy\_escape(curl,smsText,strlen(smsText)); url+=esc; curl\_free(esc); url+="&GSM="; esc=curl\_easy\_escape(curl,senderId,strlen(senderId)); url+=esc; curl\_free(esc); if(curl) { curl\_easy\_setopt(curl,CURLOPT\_URL,url.c\_str()); curl\_easy\_setopt(curl, CURLOPT\_FOLLOWLOCATION, 1L); curl\_easy\_setopt(curl,CURLOPT\_WRITEDATA,&ret); curl\_easy\_setopt(curl,CURLOPT\_WRITEFUNCTION,WriteFunction); CURLcode res = curl\_easy\_perform(curl); if(res != CURLE\_OK) { curl\_easy\_cleanup(curl); return 0; } curl\_easy\_cleanup(curl); if(ret.find("Ok")) { char\* r=new char\[ret.length()+1\]; strcpy(r,ret.c\_str()); char\* p=strtok(r,"|"); p=strtok(NULL,"|"); return atoi(p); } } return 1;
}
-
i have a code for sms send my api provider is changed below mention is my code problem is what will return my new api vender so i can use that dll in my vfp application. code
// smsservice.cpp : Defines the exported functions for the DLL application.
//#include "stdafx.h"
#include "smsservice.h"
#include using namespace std;
size_t WriteFunction( char *ptr, size_t size, size_t nmemb, void *userdata)
{
string* s=(string*)userdata;
int i;
for(i=0;ipush_back(ptr[i]);
}
return i;
}
int _declspec(dllexport) SendSms(LPCSTR userId,LPCSTR userPass,LPCSTR phoneNumber,LPCSTR smsText,LPCSTR senderId)
{
CURL* curl;
curl=curl_easy_init();
string ret;
string url="http://way2send.in/submitsms.jsp?Userid=";char\* esc=curl\_easy\_escape(curl,userId,strlen(userId)); url+=esc; curl\_free(esc); url+="&UserPassword="; esc=curl\_easy\_escape(curl,userPass,strlen(userPass)); url+=esc; curl\_free(esc); url+="&PhoneNumber="; esc=curl\_easy\_escape(curl,phoneNumber,strlen(phoneNumber)); url+=esc; curl\_free(esc); url+="&Text="; esc=curl\_easy\_escape(curl,smsText,strlen(smsText)); url+=esc; curl\_free(esc); url+="&GSM="; esc=curl\_easy\_escape(curl,senderId,strlen(senderId)); url+=esc; curl\_free(esc); if(curl) { curl\_easy\_setopt(curl,CURLOPT\_URL,url.c\_str()); curl\_easy\_setopt(curl, CURLOPT\_FOLLOWLOCATION, 1L); curl\_easy\_setopt(curl,CURLOPT\_WRITEDATA,&ret); curl\_easy\_setopt(curl,CURLOPT\_WRITEFUNCTION,WriteFunction); CURLcode res = curl\_easy\_perform(curl); if(res != CURLE\_OK) { curl\_easy\_cleanup(curl); return 0; } curl\_easy\_cleanup(curl); if(ret.find("Ok")) { char\* r=new char\[ret.length()+1\]; strcpy(r,ret.c\_str()); char\* p=strtok(r,"|"); p=strtok(NULL,"|"); return atoi(p); } } return 1;
}
-
i have a code for sms send my api provider is changed below mention is my code problem is what will return my new api vender so i can use that dll in my vfp application. code
// smsservice.cpp : Defines the exported functions for the DLL application.
//#include "stdafx.h"
#include "smsservice.h"
#include using namespace std;
size_t WriteFunction( char *ptr, size_t size, size_t nmemb, void *userdata)
{
string* s=(string*)userdata;
int i;
for(i=0;ipush_back(ptr[i]);
}
return i;
}
int _declspec(dllexport) SendSms(LPCSTR userId,LPCSTR userPass,LPCSTR phoneNumber,LPCSTR smsText,LPCSTR senderId)
{
CURL* curl;
curl=curl_easy_init();
string ret;
string url="http://way2send.in/submitsms.jsp?Userid=";char\* esc=curl\_easy\_escape(curl,userId,strlen(userId)); url+=esc; curl\_free(esc); url+="&UserPassword="; esc=curl\_easy\_escape(curl,userPass,strlen(userPass)); url+=esc; curl\_free(esc); url+="&PhoneNumber="; esc=curl\_easy\_escape(curl,phoneNumber,strlen(phoneNumber)); url+=esc; curl\_free(esc); url+="&Text="; esc=curl\_easy\_escape(curl,smsText,strlen(smsText)); url+=esc; curl\_free(esc); url+="&GSM="; esc=curl\_easy\_escape(curl,senderId,strlen(senderId)); url+=esc; curl\_free(esc); if(curl) { curl\_easy\_setopt(curl,CURLOPT\_URL,url.c\_str()); curl\_easy\_setopt(curl, CURLOPT\_FOLLOWLOCATION, 1L); curl\_easy\_setopt(curl,CURLOPT\_WRITEDATA,&ret); curl\_easy\_setopt(curl,CURLOPT\_WRITEFUNCTION,WriteFunction); CURLcode res = curl\_easy\_perform(curl); if(res != CURLE\_OK) { curl\_easy\_cleanup(curl); return 0; } curl\_easy\_cleanup(curl); if(ret.find("Ok")) { char\* r=new char\[ret.length()+1\]; strcpy(r,ret.c\_str()); char\* p=strtok(r,"|"); p=strtok(NULL,"|"); return atoi(p); } } return 1;
}
Your code looks like the native C++. So why did you post in the managed C++/CLI forum? :confused:
-
i have a code for sms send my api provider is changed below mention is my code problem is what will return my new api vender so i can use that dll in my vfp application. code
// smsservice.cpp : Defines the exported functions for the DLL application.
//#include "stdafx.h"
#include "smsservice.h"
#include using namespace std;
size_t WriteFunction( char *ptr, size_t size, size_t nmemb, void *userdata)
{
string* s=(string*)userdata;
int i;
for(i=0;ipush_back(ptr[i]);
}
return i;
}
int _declspec(dllexport) SendSms(LPCSTR userId,LPCSTR userPass,LPCSTR phoneNumber,LPCSTR smsText,LPCSTR senderId)
{
CURL* curl;
curl=curl_easy_init();
string ret;
string url="http://way2send.in/submitsms.jsp?Userid=";char\* esc=curl\_easy\_escape(curl,userId,strlen(userId)); url+=esc; curl\_free(esc); url+="&UserPassword="; esc=curl\_easy\_escape(curl,userPass,strlen(userPass)); url+=esc; curl\_free(esc); url+="&PhoneNumber="; esc=curl\_easy\_escape(curl,phoneNumber,strlen(phoneNumber)); url+=esc; curl\_free(esc); url+="&Text="; esc=curl\_easy\_escape(curl,smsText,strlen(smsText)); url+=esc; curl\_free(esc); url+="&GSM="; esc=curl\_easy\_escape(curl,senderId,strlen(senderId)); url+=esc; curl\_free(esc); if(curl) { curl\_easy\_setopt(curl,CURLOPT\_URL,url.c\_str()); curl\_easy\_setopt(curl, CURLOPT\_FOLLOWLOCATION, 1L); curl\_easy\_setopt(curl,CURLOPT\_WRITEDATA,&ret); curl\_easy\_setopt(curl,CURLOPT\_WRITEFUNCTION,WriteFunction); CURLcode res = curl\_easy\_perform(curl); if(res != CURLE\_OK) { curl\_easy\_cleanup(curl); return 0; } curl\_easy\_cleanup(curl); if(ret.find("Ok")) { char\* r=new char\[ret.length()+1\]; strcpy(r,ret.c\_str()); char\* p=strtok(r,"|"); p=strtok(NULL,"|"); return atoi(p); } } return 1;
}
Your code looks like the native C++.