title: Discord Bot: cannot create POST request for create a message
body: <p>i have a problem while i am implementing discord bot in C/C++.
  My problem is when i when i want to create message in other way create POST request to create message with my BOT i do not recieve any answer whether the request was completed or not.
  When i create GET request with specifics which is necessary due to discord documentary everything is good and i recieve what i want.
  My code is:</p>
  <pre><code>#include &lt;stdio.h&gt; 
  #include &lt;stdlib.h&gt;
  #include &lt;iostream&gt;
  #include &lt;unistd.h&gt;``
  #include &lt;bits/stdc++.h&gt; 
  #include &lt;sys/socket.h&gt; 
  #include &lt;arpa/inet.h&gt; 
  #include &lt;unistd.h&gt; 
  #include &lt;string.h&gt; 
  #include &lt;signal.h&gt;
  #include &lt;malloc.h&gt;
  #include &lt;netdb.h&gt;
  
  #include &lt;openssl/err.h&gt; /* errors */
  
  #include &lt;openssl/ssl.h&gt; /* core library */
  #include &lt;thread&gt; 
  
  #define BuffSize 8096
  
  using namespace std;
      
  SSL *ssl;
  int sock;
      
  int RecvPacket()
  {
      int len=100;
      char buf[1000000];
      do {
          len=SSL_read(ssl, buf, 100);
          buf[len]=0;
          printf(&quot;%s\n&quot;,buf);
  //        fprintf(fp, &quot;%s&quot;,buf);
      } while (len &gt; 0);
      if (len &lt; 0) {
          int err = SSL_get_error(ssl, len);
      if (err == SSL_ERROR_WANT_READ)
              return 0;
          if (err == SSL_ERROR_WANT_WRITE)
              return 0;
          if (err == SSL_ERROR_ZERO_RETURN || err == SSL_ERROR_SYSCALL || err == SSL_ERROR_SSL)
              return -1;
      }
  }
      
  int SendPacket(const char *buf)
  {
      int len = SSL_write(ssl, buf, strlen(buf));
      if (len &lt; 0) {
          int err = SSL_get_error(ssl, len);
          switch (err) {
          case SSL_ERROR_WANT_WRITE:
              return 0;
          case SSL_ERROR_WANT_READ:
              return 0;
          case SSL_ERROR_ZERO_RETURN:
          case SSL_ERROR_SYSCALL:
          case SSL_ERROR_SSL:
          default:
              return -1;
          }
      }
  }
      
  void log_ssl()
  {
      int err;
      while (err = ERR_get_error()) {
          char *str = ERR_error_string(err, 0);
          if (!str)
              return;
          printf(str);
          printf(&quot;\n&quot;);
          fflush(stdout);
      }
  }
  
  
  
  int main(int argc, char *argv[]){
  
      struct sockaddr_in socket_address_IPv4;
      struct hostent *hos;
      int socket_invoke;
        string messageId;
        string username;
        char content[1024];
        string messageBodyString;
      char messageBody[BuffSize];
      char* response_2;
      char *token=(char*)malloc(sizeof(char) * strlen(argv[1]));
      char *url_uncompleted=(char*)malloc(sizeof(char) *300);
      char *ip=(char*)malloc(sizeof(char) *100);
      struct in_addr **addr_list;
      int i=0;
      strcpy(url_uncompleted,&quot;www.discord.com:443&quot;);
      char *url = strtok(url_uncompleted, &quot;:&quot;);
      strcpy(token,argv[1]);
      
     
      socket_invoke = socket(PF_INET,SOCK_STREAM,IPPROTO_TCP);
      if(socket &lt; 0){
          fprintf(stderr,&quot;Unsuccessfull creation of seocket\n&quot;);
  
      }
      memset(&amp;socket_address_IPv4,0,sizeof(socket_address_IPv4));
      socket_address_IPv4.sin_family=AF_INET;
      
      hos=gethostbyname(url);
      if(!hos){   
          printf(&quot;chyba pri gethostbyname\n&quot;);
          close(socket_invoke);
          exit(10);
          
      }
  
      
      addr_list = (struct in_addr **) hos-&gt;h_addr_list;
  
      for(int i = 0; addr_list[i] != NULL; i++) 
      {
          //Return the first one;
          strcpy(ip , inet_ntoa(*addr_list[i]) );
          break;
      }
      printf(&quot;IP adresa je: %s\n&quot;,ip);
      socket_address_IPv4.sin_addr.s_addr=inet_addr(ip);
      socket_address_IPv4.sin_port=htons(443);
      
      
      
      if(connect(socket_invoke,(struct sockaddr*)&amp;socket_address_IPv4,sizeof(socket_address_IPv4)) &lt;0)
      {
          fprintf(stderr,&quot;connection failed\n&quot;);
          free(token);
          free(url_uncompleted);
          free(ip);
          close(socket_invoke);
  
      }
      SSL_library_init();
      SSLeay_add_ssl_algorithms();
      SSL_load_error_strings();
      const SSL_METHOD *meth = TLSv1_2_client_method();
      SSL_CTX *ctx = SSL_CTX_new (meth);
      ssl = SSL_new (ctx);
      if (!ssl) {
          printf(&quot;Error creating SSL.\n&quot;);
          log_ssl();
          return -1;
      }
      sock = SSL_get_fd(ssl);
      SSL_set_fd(ssl, socket_invoke);
      int err = SSL_connect(ssl);
      if (err &lt;= 0) {
          printf(&quot;Error creating SSL connection.  err=%x\n&quot;, err);
          log_ssl();
          fflush(stdout);
          return -1;
      }
      printf (&quot;SSL connection using %s\n&quot;, SSL_get_cipher (ssl));
      
      snprintf(messageBody, 1024, &quot;{\&quot;content\&quot;:\&quot;hi\&quot;,\n\&quot;tts\&quot;: false}&quot;);
          sprintf(content,
            &quot;POST https://discord.com/api/v6/channels/760577856702644327/messages HTTP/1.1\r\nauthorization: Bot %s\r\nContent-Type: application/json\r\nContent-Length: 1024\r\nhost: %s\r\n%s\r\nConnection: keep-alive\r\n\r\n&quot;,token,&quot;discord.com&quot;,messageBody);
            printf(&quot;%s\n&quot;,content);
      SendPacket(content);
      RecvPacket();
      
  
      
          
          
          printf(&quot;som tu\n&quot;);
          free(token);
          free(url_uncompleted);
          free(ip);
          close(socket_invoke);
  
          return 0;
  
    }
  </code></pre>
  <p>thank you for all advices</p>