Solved

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

Posted on 2004-10-20
4
218 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
  • 2
4 Comments
 
LVL 12

Expert Comment

by:OnegaZhang
Comment Utility
0
 
LVL 19

Accepted Solution

by:
mrwad99 earned 100 total points
Comment Utility
0
 
LVL 1

Author Comment

by:cafechris
Comment Utility
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
Comment Utility
>> Thanks guys for the quick responses

Glad we could help :)
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

744 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now