That VB script errors. Line 4, char 1, error 0x80072EFD. Source (null). Hope that helps...
Did you replace the "x.x.x.x" in the URL with the correct IP address? Error 0x80072EFD maps to:
Code:
ERROR_WINHTTP_CANNOT_CONNECT
12029
Returned if connection to the server failed.
This suggests that the IP address is wrong or the device is off. I'd try to get the UPnP API working before attempting to use raw HTTP. The UPnP API supports return values and events which may be complicated to implement with the raw HTTP.
Edit: Here's the code I stole off MSDN for what I beleive is initiating a web request. I can't seem to get it to compile; its made for Microsoft's compiler maybe? I'm swapping between Dev-C++ and LCC. I've already modified a bit of code to prevent a few errors, hopefully I didn't break anything while I did...
The only chages required were to replace new/delete with malloc/free. This compiles with MSVC or LCC. My version of Dev-C++ seems to be missing the winhttp header.
Code:
#include <windows.h>
#include <winhttp.h>
#include <stdio.h>
#if defined(_MSC_VER)
#pragma comment(lib, "Winhttp.lib")
#elif defined(__LCC__)
#pragma lib<WinHttp.lib>
#endif
int main(void) {
DWORD dwSize = 0;
DWORD dwDownloaded = 0;
LPSTR pszOutBuffer;
BOOL bResults = FALSE;
HINTERNET hSession = NULL,
hConnect = NULL,
hRequest = NULL;
// Use WinHttpOpen to obtain a session handle.
hSession = WinHttpOpen( L"WinHTTP Example/1.0",
WINHTTP_ACCESS_TYPE_DEFAULT_PROXY,
WINHTTP_NO_PROXY_NAME,
WINHTTP_NO_PROXY_BYPASS, 0 );
// Specify an HTTP server.
if( hSession )
hConnect = WinHttpConnect( hSession, L"www.microsoft.com",
INTERNET_DEFAULT_HTTPS_PORT, 0 );
// Create an HTTP request handle.
if( hConnect )
hRequest = WinHttpOpenRequest( hConnect, L"GET", NULL,
NULL, WINHTTP_NO_REFERER,
WINHTTP_DEFAULT_ACCEPT_TYPES,
WINHTTP_FLAG_SECURE );
// Send a request.
if( hRequest )
bResults = WinHttpSendRequest( hRequest,
WINHTTP_NO_ADDITIONAL_HEADERS, 0,
WINHTTP_NO_REQUEST_DATA, 0,
0, 0 );
// End the request.
if( bResults )
bResults = WinHttpReceiveResponse( hRequest, NULL );
// Keep checking for data until there is nothing left.
if( bResults )
{
do
{
// Check for available data.
dwSize = 0;
if( !WinHttpQueryDataAvailable( hRequest, &dwSize ) )
printf( "Error %u in WinHttpQueryDataAvailable.\n",
GetLastError( ) );
// Allocate space for the buffer.
// char pszOutBuffer;
pszOutBuffer = malloc(dwSize+1);
if( !pszOutBuffer )
{
printf( "Out of memory\n" );
dwSize=0;
}
else
{
// Read the data.
int newsize;
newsize = dwSize+1;
ZeroMemory( pszOutBuffer, newsize );
if( !WinHttpReadData( hRequest, (LPVOID)pszOutBuffer,
dwSize, &dwDownloaded ) )
printf( "Error %u in WinHttpReadData.\n", GetLastError( ) );
else
printf( "%s", pszOutBuffer );
// Free the memory allocated to the buffer.
free(pszOutBuffer);
}
} while( dwSize > 0 );
}
// Report any errors.
if( !bResults )
printf( "Error %d has occurred.\n", GetLastError( ) );
// Close any open handles.
if( hRequest ) WinHttpCloseHandle( hRequest );
if( hConnect ) WinHttpCloseHandle( hConnect );
if( hSession ) WinHttpCloseHandle( hSession );
return 0;
}