LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

POST HTTP to a WEB Brauser

Hi
I create a Web server on my computer
I write in the address bar:
http://127.0.0.1/denwer/index.php?NDatch=25&Sost=Oк.
The server accepts the values: 25 & Ok.
Then I created the program in LV.
The server does not accept values: 25 & Ok from LV.
Where am I wrong?

With respect.

Iskander

0 Kudos
Message 1 of 9
(4,168 Views)

What do you mean?

 

It looks like the values were accepted:

<tr><td class="e">_POST["NDatch"]</td><td class="v">25</td></tr>
<tr><td class="e">_POST["Sost"]</td><td class="v">Ok</td></tr>

 

Of course, when you write the variables into the address bar, the data goes into $_GET rather than $_POST which is what looks like is happening here.

 

If the server is expecting the data via $_GET, you'll need to modify the URL to include the variables (e.g. using format into string) - or you can modify your script to accept $_POST data.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 2 of 9
(4,145 Views)

Thanks

Pert of Index.php:

<body>
<form action="URL" method="POST">
<input type="NDatch">
<input type="Sost">
<h1> ПРОБА_1</h1>
</form>

 <?php
   phpinfo(32);
   $Dat1=date("H:i:s d.m"); 
  $Par1=$_POST["NDatch"];
  $Par2=$_POST["Sost"];

 

I changed in my VI "GET" to "POST"

Don't work

Respect

0 Kudos
Message 3 of 9
(4,119 Views)

But you can clearly see that the data is being sent in the PHPInfo() output that you get in the 'response body' from the HTTP Post VI (the part I quoted above) - which means it is being received by the server so the issue is with your PHP script, and not with the LabVIEW code.

 

If you do a "print_r($_POST);", what does it contain? That should write out the contents of the $_POST array to the script - you should see something like:

 

Array

(

   [NDatch] = 25,

   [Sost] = "OK"

)


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 4 of 9
(4,095 Views)

Hi

The copy of the  phpinfo(32) in the file;

Array is empty

(

[NDatch] =

[Sost] =

)

I think : the problem is in the DENWER

Thank

 

0 Kudos
Message 5 of 9
(4,085 Views)

In the screenshot - the $_GET variables in the URL of the browser are empty - that is why the fields are empty.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 6 of 9
(4,076 Views)

Hi

My program LV is sending data.
But the web browser does not see 

And so the variables are empty

I do not know what to do

With respect

 

0 Kudos
Message 7 of 9
(4,053 Views)
The web browser will not see the values that LabVIEW is sending.

I think you misunderstand how HTTP/PHP communications works.

When you make the request from LabVIEW, LabVIEW receives the response with the data (in the response body text from the HTTP Post VI - this is the same HTML code you would get if you accessed the page from a browser). You cannot view the data you sent from LabVIEW from another client/web-browser (because that would be really insecure!!!) unless you store that data on the PHP server. You could store the data in a file on the PHP server, or you could store it in a database.

LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 8 of 9
(4,047 Views)

Hi

Thanks

I understood
I have the question.
I have the equipment that is polled LV with intervals (10 seconds). Then this information are sent to the web server, where it (the program PHP) are stored in the database.
how can I solve this problem using the LV?

With respect.

0 Kudos
Message 9 of 9
(4,011 Views)