I am using this code for uploading a data in web but here is some error in this code.
here is a code.
Code:
#include <windows.h>
#include <wininet.h>
#include <tchar.h>
#include <iostream>
#include <string>
#include <sstream>

#pragma comment(lib, "ws2_32.lib")

int main(){

TCHAR hdrs[] = _T("Content-Type: application/x-www-form-urlencoded");
TCHAR frmdata[] = _T("name=John+Doe&userid=hithere&other=P%26Q");
LPCTSTR accept[] = {_T("*/*"), NULL};

HINTERNET hSession = InternetOpen(_T("MyAgent"), INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
HINTERNET hConnect = InternetConnect(hSession, _T("http://localhost"), INTERNET_DEFAULT_HTTP_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 1);
HINTERNET hRequest = HttpOpenRequest(hConnect, _T("POST"), _T("/upload.php"), NULL, NULL, accept, 0, 1);
HttpSendRequest(hRequest, hdrs, _tcslen(hdrs), frmdata, _tcslen(frmdata));


return 0;

}
Here is a php code.

PHP Code:
<?php

$name 
$_POST['name'];
$userid $_POST['userid'];
$other $_POST['other'];

$myfile fopen("newfile.txt""w") or die("Unable to open file!");
$txt1 $name."\n";
fwrite($myfile$txt1);
$txt2 $userid."\n";
fwrite($myfile$txt2);
$txt3 $other."\n";
fwrite($myfile$txt3);
fclose($myfile);

?>
Here is a [liker error]. I am using dev c++ for compiling that.