Solved

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

Posted on 2004-10-20
4
222 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
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
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.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

828 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