Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 3 of 3 total |
Request problem |
Wed, Mar 20 2013 3:20 PM | Permanent Link |
Uli Becker | I am trying to send a POST request to a php script:
with GetRequest do begin URL := 'android_testpost.php'; GetRequest.params.clear; GetRequest.Params.Add('spieltag=30'); Execute; end; with PostRequest do begin method = rmPost; URL := 'android_testpost.php'; PostRequest.params.clear; PostRequest.Params.Add('ligaid=test1'); RequestHeaders.Values['Content-Type'] := 'plain/text'; RequestHeaders.Values['Content-Length']:=IntToStr(Length(RequestContent.Text)); Execute; end; Whatever I tried: the script was able to read the GET-variable that I sent with a GET-request, but not the POST-variable sent with a POST-request. I wrote this simple php-code just to test that: if (count($_GET) > 0) { echo "Get-Variable found"; } else { echo "No Get-Variable found"; } if (count($_POST) > 0) { echo "Post-Variable found"; } else { echo "No Post-Variable found"; } Funny: When I send a POST-request, the script tells me "Get-Variable found", but it NEVER says "Post-Variable found". Am I doing something wrong? Uli |
Wed, Mar 20 2013 4:32 PM | Permanent Link |
Peter | when you set the RequestContent instead of setting the Params
RequestContent.Clear(); RequestContent.Add('ligaid=test1'); ... you can get the postdata with: $postdata = file_get_contents("php://input"); Greetings ... Peter --- Sorry for my weird english |
Thu, Mar 21 2013 3:22 AM | Permanent Link |
Uli Becker | Peter,
thanks. Since I have never used a post request, I didn't realize that params are always get variables. Sorry about the silly question. Regards Uli |
This web page was last updated on Sunday, December 1, 2024 at 03:59 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |