Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Managed C++/CLI
  4. c++ sms send dll

c++ sms send dll

Scheduled Pinned Locked Moved Managed C++/CLI
c++javajsonhelpquestion
4 Posts 4 Posters 12 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 13944139
    wrote on last edited by
    #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;
    

    }

    L V V 3 Replies Last reply
    0
    • U User 13944139

      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;
      

      }

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      What is the question? And why have you posted this in the Managed C++/CLI section?

      1 Reply Last reply
      0
      • U User 13944139

        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;
        

        }

        V Offline
        V Offline
        Victor Nijegorodov
        wrote on last edited by
        #3

        Your code looks like the native C++. So why did you post in the managed C++/CLI forum? :confused:

        1 Reply Last reply
        0
        • U User 13944139

          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;
          

          }

          V Offline
          V Offline
          vidhya 360 com
          wrote on last edited by
          #4

          Your code looks like the native C++.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups