Solved

send (php)url with vars & no browser window (os:windows)

Posted on 2004-10-20
4
224 Views
Last Modified: 2010-04-01
I have a php file on my webspace that uses my computername and Username when I send it.
I have no problem gathering the this information. The problem is sending it without opening a browser window.
I have never done any socket prog. so I would rather not go this route. I have tried the following commented out parts below.
And have tried pinging the site. Non of this seems to activate the php file.

So My question in simple form would be:
How do I access a url, without opening a browser window. Allowing my php file to use the variable in the url.

I have posted my current simplified code below:


#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <Wininet.h>
#include <shellapi.h>

#define MX 500

int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{

      char cName[MX] = "NULL";
      char uName[MX] = "NULL";
      unsigned long bufSize = MX;

      // get Computer and User name
      GetComputerName(cName,&bufSize);
      GetUserName(uName,&bufSize);

      char str[1024];

      sprintf(str, "http://MyWebsite.com/phpFile.php?cName=%s&uName=%s",cName , uName);

      //  ShellExecute(NULL, "open", str, NULL, NULL, SW_HIDE); //tried no file written

      //InternetOpenUrl(NULL,str,NULL,0,0, NULL); //tried no file written


               MessageBox(0,str,"Info",0);

      return 0;
}

0
Comment
Question by:cafechris
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 12

Expert Comment

by:OnegaZhang
ID: 12356640
0
 
LVL 19

Accepted Solution

by:
mrwad99 earned 100 total points
ID: 12358401
0
 
LVL 1

Author Comment

by:cafechris
ID: 12361108
mrwad99
Thanks, I forgot to try that one late last night. I just used it last week too......must have been a late one.

Onega Zhang, thanks, but I already understood mrwad99's post. I will try to figure out yours when I get some time.

Thanks guys for the quick responses
0
 
LVL 19

Expert Comment

by:mrwad99
ID: 12361211
>> Thanks guys for the quick responses

Glad we could help :)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Find Visual Studio Tools 2 135
c++ substatte a varabe for a string in a LPCTSTR statment 8 100
How to gracefully close the c++ 11 thread? 3 157
visual C++ 1 41
In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question