Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #13240 > unrolled thread

GetorPost

Started byNick Vlachou <nickvlachou38@gmail.com>
First post2021-02-22 08:47 -0800
Last post2021-02-27 23:24 +0100
Articles 9 — 2 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  GetorPost Nick Vlachou <nickvlachou38@gmail.com> - 2021-02-22 08:47 -0800
    Re: GetorPost nk <norbert.k@chello.at> - 2021-02-23 01:35 +0100
      Re: GetorPost Nick Vlachou <nickvlachou38@gmail.com> - 2021-02-23 06:51 -0800
        Re: GetorPost nk <norbert.k@chello.at> - 2021-02-24 00:33 +0100
          Re: GetorPost Nick Vlachou <nickvlachou38@gmail.com> - 2021-02-24 07:12 -0800
            Re: GetorPost nk <norbert.k@chello.at> - 2021-02-25 00:17 +0100
              Re: GetorPost Nick Vlachou <nickvlachou38@gmail.com> - 2021-02-26 17:36 -0800
                Re: GetorPost Nick Vlachou <nickvlachou38@gmail.com> - 2021-02-27 08:08 -0800
                  Re: GetorPost nk <norbert.k@chello.at> - 2021-02-27 23:24 +0100

#13240 — GetorPost

FromNick Vlachou <nickvlachou38@gmail.com>
Date2021-02-22 08:47 -0800
SubjectGetorPost
Message-ID<b5ed8477-d532-4a71-8b44-d3447e053314n@googlegroups.com>
I am using Norbert's code to send data to a form. The web returns the form's code but the form does not appear to receive the data I am sending.

Executing the form using a browser works just fine. In the example php I have posted I simply write to  file but I also have php code using sql to update a mysql database. This also works just fine. using the browser

Any help is appreciated.

Web Form File
============
<form action="params_login.php" method="post" enctype="multipart/form-data" id="testparams">

 <p>User<input name="user" type="text" value="<?php if (isset($_POST['user'])) echo $_POST['user']; else echo "Enter username here!";
<p>License Key<input name="license" type="text" value="example key" /> </p>
<p>Last Used Date<input name="lastdate" type="date" value="2021-11-03" /> </p>
<p><input type="submit" name="Submit" value="Send" /> </p>
</form>

Web Action File
=============
<?php
$User = $_POST['user'];
$Submit = $_POST['Submit'];
$f=fopen("Login.txt","a");
fwrite($f,"-----\r\n");
fwrite($f,"$User\r\n");
fwrite($f,"$Submit\r\n");
fwrite($f,"-----\r\n");
fclose($f);
?>

VO Code
=======
LOCAL oHttp AS cHttp
LOCAL cPage AS STRING
LOCAL cServer AS STRING
LOCAL cFolder AS STRING
LOCAL cData AS STRING
LOCAL cHeader AS STRING

cServer  := "192.168.0.110"
cFolder  := "/goals-master/params_rcv.php"
cData    := "user=Nick Vlachou&license=XXXX-AAAA&lastdate=2021-01-01&Submit=Send"

cHeader  := "Accept: *" + "/" + "*" + CrLf + ;
            "Content-Type: application/x-www-formurlencoded" + CrLf + ;
            "Accept-Encoding: gzip, deflate" + CrLf +CrLf

oHttp    := cHttp{"TestPOST"}

cPage    :=oHttp:GetDocumentByGetOrPost(cServer,cFolder, cData, cHeader, "POST", ;
           /*INTERNET_DEFAULT_HTTPS_PORT*/, /*INTERNET_FLAG_SECURE */ )

FabMessageInfo( "GetorPost Result: " + CRLF + cPage )

oHttp:CloseRemote()
oHttp:Axit()

RETURN

[toc] | [next] | [standalone]


#13241

Fromnk <norbert.k@chello.at>
Date2021-02-23 01:35 +0100
Message-ID<s11ikr$1o0i$1@gioia.aioe.org>
In reply to#13240
Hi Nick,

in your php-code you use enctype="multipart/form-data" and in VO 
"Content-Type: application/x-www-formurlencoded".
If you use multipart in VO, then cPostData must also be constructed as 
multipart.

Here is the code (not tested):

oHttp 	:= CHttp{"VoTest"}
//	oHttp:UserName := "user"
//	oHttp:PassWord := "pw"

// to identify the boundary something like that
cBoundary := "--UPLOAD--BOUNDARY--huklfehnv--UPLOAD-BOUNDARY--"
	
// include to the header
cHeader := 	"Accept: *" + "/" + "*" + CrLf +;
	   	"Content-Type: multipart/form-data; boundary=" + cBoundary + CrLf +;
            	"Accept-Language: de-at,de;q=0.5" + CrLf + CrLf
	
// send data
// The dashes before and after the last boundary value,
// as well as the positioning of the CrLf variables
// is critical to the successful functioning of this process.
// Also, if you plan on posting binary data to the form,
// run the data through the Base64 algorithm.
cPostData := "--" + cBoundary + CrLf +;
	[Content-Disposition: form-data; name="user" + CrLf + CrLf +;
	[Nick Vlachou] + CrLf +;
	"--" + cBoundary + CrLf +;
	[Content-Disposition: form-data; name="license"] + CrLf + CrLf +;
	[XXXX-AAAA] + CrLf +;
	"--" + cBoundary + CrLf +;
	[Content-Disposition: form-data; name="lastdate"] + CrLf + CrLf +;
	[2021-01-01] + CrLf +;
	"--" + cBoundary + CrLf +;
	[Content-Disposition: form-data; name="Submit"] + CrLf + CrLf +;
	[Send] + CrLf +;
	"--" + cBoundary + "--"
	
cPage 	:= oHttp:GetDocumentByGetOrPost( "www.myserver.com",;
	"/test/webapp.asp?TCI=schema&RSE=Upload",;
	cPostData,;
	cHeader,;
	"POST",;
	/*INTERNET_DEFAULT_HTTPS_PORT*/,;
	/*INTERNET_FLAG_SECURE*/)

Hope this will help you

Norbert


Am 22.02.2021 um 17:47 schrieb Nick Vlachou:
> I am using Norbert's code to send data to a form. The web returns the form's code but the form does not appear to receive the data I am sending.
> 
> Executing the form using a browser works just fine. In the example php I have posted I simply write to  file but I also have php code using sql to update a mysql database. This also works just fine. using the browser
> 
> Any help is appreciated.
> 
> Web Form File
> ============
> <form action="params_login.php" method="post" enctype="multipart/form-data" id="testparams">
> 
>   <p>User<input name="user" type="text" value="<?php if (isset($_POST['user'])) echo $_POST['user']; else echo "Enter username here!";
> <p>License Key<input name="license" type="text" value="example key" /> </p>
> <p>Last Used Date<input name="lastdate" type="date" value="2021-11-03" /> </p>
> <p><input type="submit" name="Submit" value="Send" /> </p>
> </form>
> 
> Web Action File
> =============
> <?php
> $User = $_POST['user'];
> $Submit = $_POST['Submit'];
> $f=fopen("Login.txt","a");
> fwrite($f,"-----\r\n");
> fwrite($f,"$User\r\n");
> fwrite($f,"$Submit\r\n");
> fwrite($f,"-----\r\n");
> fclose($f);
> ?>
> 
> VO Code
> =======
> LOCAL oHttp AS cHttp
> LOCAL cPage AS STRING
> LOCAL cServer AS STRING
> LOCAL cFolder AS STRING
> LOCAL cData AS STRING
> LOCAL cHeader AS STRING
> 
> cServer  := "192.168.0.110"
> cFolder  := "/goals-master/params_rcv.php"
> cData    := "user=Nick Vlachou&license=XXXX-AAAA&lastdate=2021-01-01&Submit=Send"
> 
> cHeader  := "Accept: *" + "/" + "*" + CrLf + ;
>              "Content-Type: application/x-www-formurlencoded" + CrLf + ;
>              "Accept-Encoding: gzip, deflate" + CrLf +CrLf
> 
> oHttp    := cHttp{"TestPOST"}
> 
> cPage    :=oHttp:GetDocumentByGetOrPost(cServer,cFolder, cData, cHeader, "POST", ;
>             /*INTERNET_DEFAULT_HTTPS_PORT*/, /*INTERNET_FLAG_SECURE */ )
> 
> FabMessageInfo( "GetorPost Result: " + CRLF + cPage )
> 
> oHttp:CloseRemote()
> oHttp:Axit()
> 
> RETURN
> 

[toc] | [prev] | [next] | [standalone]


#13242

FromNick Vlachou <nickvlachou38@gmail.com>
Date2021-02-23 06:51 -0800
Message-ID<a1d42d06-d4f7-45a4-9004-fc17d0aae39fn@googlegroups.com>
In reply to#13241
Hi Norbert

Thanks so much for your early response. Certainly put me in the right direction.
At first I could not get it to work but after displaying the cPostData on screen I found that ;name="user" was missing the closing square bracket.
Problem was, I could not get the <form action="params_login.php"  to execute.
After testing the $_POST["variable name"] in the form, the cPostData was available so I moved the params_login code to the bottom of the form and it all works well.

My question is, can I get the form action to execute once the form has received the cPostData or do I need to include all the code in the form?
I suppose I could write a function to call the "params_login.php" if the submit button contains the correct value; e.g. Default="No" and cPostData could pass "Yes" or true/false.

Your code has been a lifesaver for me in the past and from the plethora of posts, it seems that many others have benefited from your support.

Thanks Norbert.

NV

On Tuesday, February 23, 2021 at 8:35:45 AM UTC+8, nk wrote:

> // send data 
> // The dashes before and after the last boundary value, 
> // as well as the positioning of the CrLf variables 
> // is critical to the successful functioning of this process. 
> // Also, if you plan on posting binary data to the form, 
> // run the data through the Base64 algorithm. 
> cPostData := "--" + cBoundary + CrLf +; 
> [Content-Disposition: form-data; name="user" + CrLf + CrLf +; 
> [Nick Vlachou] + CrLf +; 
> "--" + cBoundary + CrLf +; 
> [Content-Disposition: form-data; name="license"] + CrLf + CrLf +; 
> [XXXX-AAAA] + CrLf +; 
> "--" + cBoundary + CrLf +; 
> [Content-Disposition: form-data; name="lastdate"] + CrLf + CrLf +; 
> [2021-01-01] + CrLf +; 
> "--" + cBoundary + CrLf +; 
> [Content-Disposition: form-data; name="Submit"] + CrLf + CrLf +; 
> [Send] + CrLf +; 
> "--" + cBoundary + "--" 
> 
> cPage := oHttp:GetDocumentByGetOrPost( "www.myserver.com",; 
> "/test/webapp.asp?TCI=schema&RSE=Upload",; 
> cPostData,; 
> cHeader,; 
> "POST",; 
> /*INTERNET_DEFAULT_HTTPS_PORT*/,; 
> /*INTERNET_FLAG_SECURE*/) 
> 
> Hope this will help you 
> 
> Norbert

[toc] | [prev] | [next] | [standalone]


#13248

Fromnk <norbert.k@chello.at>
Date2021-02-24 00:33 +0100
Message-ID<s143d2$1c6$1@gioia.aioe.org>
In reply to#13242
Hi Nick!

If I have understood you correctly, you are sending the data to a page 
written in php with the submit. This page should check the submitted 
parameters and only process them if the values are correct. Otherwise it 
should return an error message.

Thank you for your kind words. Yes, I have been able to help some people 
with this and I am happy to do so if I can.

Kind regards

Norbert

> My question is, can I get the form action to execute once the form has received the cPostData or do I need to include all the code in the form?
> Your code has been a lifesaver for me in the past and from the plethora of posts, it seems that many others have benefited from your support.
> 
> Thanks Norbert.

[toc] | [prev] | [next] | [standalone]


#13251

FromNick Vlachou <nickvlachou38@gmail.com>
Date2021-02-24 07:12 -0800
Message-ID<5e1c013e-6b7c-494c-87af-0f42b216b2a3n@googlegroups.com>
In reply to#13248
Hi Norbert

Yes, your understanding is correct. 

The problem I have encountered is that the url with the <form> works just fine as long as the logic is stored in this file.
<form action="somefile.php" etc ect </form> fires the action if I run this file from a browser, however, sending the requests via cavo/getorpost the somefile.php does not get called.
I would normally write my logic in files separate from the file containing the <form><fields> but sending the requests via cavo I can only access the $_POST variables in the file containing the <form>.

Simply put, if I could fire the submit button in the form, everything would work as expected.

The end target is to monitor when my_cavo_application.exe is being used by updating a database on the server.
Perhaps there is a better alternative but I haven't had time to investigate.

Any guidance is appreciated.

NV

On Wednesday, February 24, 2021 at 7:34:00 AM UTC+8, nk wrote:
> Hi Nick! 
> 
> If I have understood you correctly, you are sending the data to a page 
> written in php with the submit. This page should check the submitted 
> parameters and only process them if the values are correct. Otherwise it 
> should return an error message. 
> 
> Thank you for your kind words. Yes, I have been able to help some people 
> with this and I am happy to do so if I can. 
> 
> Kind regards 
> 
> Norbert
> > My question is, can I get the form action to execute once the form has received the cPostData or do I need to include all the code in the form?
> > Your code has been a lifesaver for me in the past and from the plethora of posts, it seems that many others have benefited from your support. 
> > 
> > Thanks Norbert.

[toc] | [prev] | [next] | [standalone]


#13252

Fromnk <norbert.k@chello.at>
Date2021-02-25 00:17 +0100
Message-ID<s16mqv$ai0$1@gioia.aioe.org>
In reply to#13251
Hi Nick!

Did you write the web page with the form yourself or is it a page from 
the web? It might help if you go to the page with the form for the data 
first. If this is a public URL, then send me (by mail) the data and I 
look at it. Often there are additional hidden variables.

Let's see what else I can do.

Kind regards
Norbert


Am 24.02.2021 um 16:12 schrieb Nick Vlachou:
> Hi Norbert
> 
> Yes, your understanding is correct.
> 
> The problem I have encountered is that the url with the <form> works just fine as long as the logic is stored in this file.
> <form action="somefile.php" etc ect </form> fires the action if I run this file from a browser, however, sending the requests via cavo/getorpost the somefile.php does not get called.
> I would normally write my logic in files separate from the file containing the <form><fields> but sending the requests via cavo I can only access the $_POST variables in the file containing the <form>.
> 
> Simply put, if I could fire the submit button in the form, everything would work as expected.
> 
> The end target is to monitor when my_cavo_application.exe is being used by updating a database on the server.
> Perhaps there is a better alternative but I haven't had time to investigate.
> 

[toc] | [prev] | [next] | [standalone]


#13256

FromNick Vlachou <nickvlachou38@gmail.com>
Date2021-02-26 17:36 -0800
Message-ID<53daa8ef-678e-4d90-902b-69f0984fcb9cn@googlegroups.com>
In reply to#13252
Hi Norbert

I have written all the code myself, cavo, html, php.
As soon as I can, I will send you details for you to test.

Thanks,
Nick

On Thursday, February 25, 2021 at 7:17:55 AM UTC+8, nk wrote:
> Hi Nick! 
> 
> Did you write the web page with the form yourself or is it a page from 
> the web? It might help if you go to the page with the form for the data 
> first. If this is a public URL, then send me (by mail) the data and I 
> look at it. Often there are additional hidden variables. 
> 
> Let's see what else I can do. 
> 
> Kind regards 
> Norbert
> Am 24.02.2021 um 16:12 schrieb Nick Vlachou: 
> > Hi Norbert 
> > 
> > Yes, your understanding is correct. 
> > 
> > The problem I have encountered is that the url with the <form> works just fine as long as the logic is stored in this file. 
> > <form action="somefile.php" etc ect </form> fires the action if I run this file from a browser, however, sending the requests via cavo/getorpost the somefile.php does not get called. 
> > I would normally write my logic in files separate from the file containing the <form><fields> but sending the requests via cavo I can only access the $_POST variables in the file containing the <form>. 
> > 
> > Simply put, if I could fire the submit button in the form, everything would work as expected. 
> > 
> > The end target is to monitor when my_cavo_application.exe is being used by updating a database on the server. 
> > Perhaps there is a better alternative but I haven't had time to investigate. 
> >

[toc] | [prev] | [next] | [standalone]


#13258

FromNick Vlachou <nickvlachou38@gmail.com>
Date2021-02-27 08:08 -0800
Message-ID<8f54de92-0b3e-4f6e-9f40-cbb83773efaen@googlegroups.com>
In reply to#13256
Hi Norbert

I would like to send you some files so you can see exactly what I am trying to achieve.
Unfortunately, the email address I used has bounced.
Would you be so kind and send me an email so that I can send again.

Thanks, Nick

On Saturday, February 27, 2021 at 9:36:25 AM UTC+8, Nick Vlachou wrote:
> Hi Norbert 
> 
> I have written all the code myself, cavo, html, php. 
> As soon as I can, I will send you details for you to test. 
> 
> Thanks, 
> Nick
> On Thursday, February 25, 2021 at 7:17:55 AM UTC+8, nk wrote: 
> > Hi Nick! 
> > 
> > Did you write the web page with the form yourself or is it a page from 
> > the web? It might help if you go to the page with the form for the data 
> > first. If this is a public URL, then send me (by mail) the data and I 
> > look at it. Often there are additional hidden variables. 
> > 
> > Let's see what else I can do. 
> > 
> > Kind regards 
> > Norbert 
> > Am 24.02.2021 um 16:12 schrieb Nick Vlachou: 
> > > Hi Norbert 
> > > 
> > > Yes, your understanding is correct. 
> > > 
> > > The problem I have encountered is that the url with the <form> works just fine as long as the logic is stored in this file. 
> > > <form action="somefile.php" etc ect </form> fires the action if I run this file from a browser, however, sending the requests via cavo/getorpost the somefile.php does not get called. 
> > > I would normally write my logic in files separate from the file containing the <form><fields> but sending the requests via cavo I can only access the $_POST variables in the file containing the <form>. 
> > > 
> > > Simply put, if I could fire the submit button in the form, everything would work as expected. 
> > > 
> > > The end target is to monitor when my_cavo_application.exe is being used by updating a database on the server. 
> > > Perhaps there is a better alternative but I haven't had time to investigate. 
> > >

[toc] | [prev] | [next] | [standalone]


#13259

Fromnk <norbert.k@chello.at>
Date2021-02-27 23:24 +0100
Message-ID<s1egr8$tno$1@gioia.aioe.org>
In reply to#13258
Hi Nick,

try

n dot kolb at chello dot at

Norbert

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web