Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

setting $_SERVER with Microsoft.XMLHTTP

Status
Not open for further replies.

robdon

Programmer
May 21, 2001
252
ES
Hi,

I'm opening a web page using:

Set objHTTP = CreateObject("Microsoft.XMLHTTP")
objHTTP.Open "GET", "http:xxxx", bolGetAsAsync
objHTTP.send


What I want to be able to do is set a $_SERVER var, before I call the page, so that the page (PHP) can check it.

I want my php script on the web page to be able to check a var like $HTTP_SERVER_VARS["HTTP_MY_VAR"]

Any ideas how it set that before I call the open page, in VB?

Thanks.

Rob.

ProIV Resource Centre
 
>Any ideas how it set that before I call the open page, in VB?
You should set up rather a session variable instead. This is how.

[1] Set up a dedicated php on the server, say prep.php. It response by sending the session id to the client. It takes a query string of name x, say, to initialize it's value, otherwise, it set it up with some default value. This is the bare-bone of it.
[tt]
<?
session_start();
if (isset($_GET['x'])) {
$_SESSION['x']=$_GET['x'];
} else {
$_SESSION['x']='some default value';
}
echo "PHPSESSID=".session_id();
?>
[/tt]
[2] At time-1, you send the value you want to set query of x, say "abc", to set it up, and capture the session id in the variable sessid, say.
[tt]
objHTTP.Open "GET", "[ignore][/ignore]", false
objHTTP.send
sessid=objHTTP.responsetext
[/tt]
[3] At time-2, do some other stuff. During the time, it is not excluded that the session variable x be altered by some other program(s) or remains invariant. As long as it is within the period of lifetime of the session before it expires.

[4] At time-3, you call the page [ignore][/ignore], (figuratively http:xxxx in your script). But now, you pass back the session id.
[tt]
objHTTP.Open "GET", "[ignore][/ignore]" & "?" & sessid, bolGetAsAsync
objHTTP.send
[/tt]
[5] In the page main.php, (ie http:xxxx), the checking of the session variable $_SESSION['x'] will take place.

And you're done.
 
Hi,

Thanks, but thats not 'quite' what I mean.

Maybe my example was not that clear... sorry...

I have no way to change the server side, I want to be able to make my VB app send the $_SERVER var...

The server is already checking the $_SERVER var, and I have no control of that.

Thanks,

Rob.



ProIV Resource Centre
 
Without the other side cooperating/consenting, meaning mapping out the scope of the application functionality itself to begin with, I don't see the meaning of the query even to subversively setting a senseless and arbitrary temporary variable (with get) that the server will not check for it in any case, though the client-side could see it in the response page which in that sense is not meaningless, good or bad. Maybe you can ask the php forum see what the experts there have to say.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top