title: Read from raw paste in c++
body: <p>So, i was wondering if it is possible(most likely without the useage of a libary) to read the raw paste/or better say the html code of a website using c++. All the codes/tutorials i found wasn't really helpful, so i was wondering if some of you could help me out. I want to read of of this link:</p>
  
  <blockquote>
    <p><a href="http://pastebin.com/raw/93HGpGG0" rel="nofollow noreferrer">http://pastebin.com/raw/93HGpGG0</a></p>
  </blockquote>
  
  <p>that code seems to be what im looking for but im missing Network and Http class...</p>
  
  <pre><code>bool Http::Connect(YString addr)
  {
      _socket = Network::CreateConnectSocket(addr, 53); // 53 is the port
      return _socket != INVALID_SOCKET;
  }
  int iResult;
  SOCKET ConnectSocket = INVALID_SOCKET;
  
  // holds address info for socket to connect to
  struct addrinfo *result = NULL,
      *ptr = NULL,
      hints;
  
  ZeroMemory(&amp;hints, sizeof(hints));
  hints.ai_family = AF_UNSPEC;
  hints.ai_socktype = SOCK_STREAM;
  hints.ai_protocol = IPPROTO_TCP;  //TCP connection!!!
  
                                    //resolve server address and port
  iResult = getaddrinfo(addr.c_str(), std::to_string(port).c_str(), &amp;hints, &amp;result);
  if (iResult != 0)
  {
      printf("Network::CreateSocket failed with %s as addr, and %i as port.\nError code: %i.\n", (char*)addr.c_str(), port, iResult);
      return INVALID_SOCKET;
  }
  
  for (ptr = result; ptr != NULL; ptr = ptr-&gt;ai_next) {
  
      // Create a SOCKET for connecting to server
      ConnectSocket = socket(ptr-&gt;ai_family, ptr-&gt;ai_socktype, ptr-&gt;ai_protocol);
  
      if (ConnectSocket == INVALID_SOCKET) {
          printf("Network::CreateSocket failed with error: %ld\n", WSAGetLastError());
          return INVALID_SOCKET;
      }
  
      // Connect to server.
      iResult = connect(ConnectSocket, ptr-&gt;ai_addr, (int)ptr-&gt;ai_addrlen);
  
      if (iResult == SOCKET_ERROR)
      {
          closesocket(ConnectSocket);
          ConnectSocket = INVALID_SOCKET;
          printf("Network::CreateSocket failed the server is down... did not connect.\n");
      }
  }
  
  freeaddrinfo(result);
  
  if (ConnectSocket == INVALID_SOCKET)
  {
      printf("Network::CreateSocket failed.\n");
      return INVALID_SOCKET;
  }
  
  u_long iMode = 1;
  iResult = ioctlsocket(ConnectSocket, FIONBIO, &amp;iMode);
  if (iResult == SOCKET_ERROR)
  {
      printf("Network::CreateSocket ioctlsocket failed with error: %d\n", WSAGetLastError());
      closesocket(ConnectSocket);
      return INVALID_SOCKET;
  }
  char value = 1;
  setsockopt(ConnectSocket, IPPROTO_TCP, TCP_NODELAY, &amp;value, sizeof(value));
  return ConnectSocket;
  </code></pre>
  
  <p><a href="https://stackoverflow.com/questions/34387033/winsock-2-reading-text-from-a-url">Winsock 2 Reading text from a URL</a> this was the post i got the coding from!</p>
  
  <p>Hopefully someone can help me out im searching for this since may xD</p>