Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

https POST request



Hi,

I try to realize follow request:

https://www.someurl.com/script.php?param1=value1&param2=value2

It's not work, when I try to use this:
WebBrowser.Navigate('https://www.someurl.com/script.php?param1=value1&param2=value2
')

I try second method:


strPostData := 'param1=value1&param2=value2';
PostData := VarArrayCreate([0, Length(strPostData) - 1], varByte);
Data := VarArrayLock(PostData);
try
Move(strPostData[1], Data^, Length(strPostData));
finally
VarArrayUnlock(PostData);
end;
URL := 'https://www.someurl.com/script.php';
Flags := EmptyParam;
TargetFrameName := EmptyParam;
Headers := EmptyParam;
Form1.Web.Navigate2(URL, Flags, TargetFrameName, PostData, Headers);

But it's not working too..

Any ideas? May be I wrong some with headers?

Thank you!

Comments

  • zibadianzibadian Posts: 6,349Member
    :
    :
    : Hi,
    :
    : I try to realize follow request:
    :
    : https://www.someurl.com/script.php?param1=value1&param2=value2
    :
    : It's not work, when I try to use this:
    : WebBrowser.Navigate('https://www.someurl.com/script.php?param1=value1&param2=value2
    : ')
    :
    : I try second method:
    :
    :
    : strPostData := 'param1=value1&param2=value2';
    : PostData := VarArrayCreate([0, Length(strPostData) - 1], varByte);
    : Data := VarArrayLock(PostData);
    : try
    : Move(strPostData[1], Data^, Length(strPostData));
    : finally
    : VarArrayUnlock(PostData);
    : end;
    : URL := 'https://www.someurl.com/script.php';
    : Flags := EmptyParam;
    : TargetFrameName := EmptyParam;
    : Headers := EmptyParam;
    : Form1.Web.Navigate2(URL, Flags, TargetFrameName, PostData, Headers);
    :
    : But it's not working too..
    :
    : Any ideas? May be I wrong some with headers?
    :
    : Thank you!
    :
    The Navigate() method of the TWebBrowser doesn't make a POST request, but a GET request.
  • Eryto MilanskiEryto Milanski Posts: 31Member

    : The Navigate() method of the TWebBrowser doesn't make a POST request, but a GET request.
    :

    That's true, but I've used Navigate2() method too, but it can't work too!
    Here is from Delphi's help:

    "PostData contains the data sent to the server when using Navigate to generate an HTTP POST message. If PostData is NULL, Navigate generates an HTTP GET message. PostData is ignored if URL does not specify an HTTP URL."

    Well, I've can't sent the request...

Sign In or Register to comment.