Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread Phonegap and Server Request
Wed, May 23 2018 4:31 AMPermanent Link

Pasquale

Web Pos srl

I'm trying to use the server request with Phonegap. It works on the notebook but not on the smartphone. Why?
This is a simple test code:
procedure TForm1.Button1Click(Sender: TObject);
begin
    ServerRequest1.URL := './hello.php';
    
    ServerRequest1.RequestContent.Clear;
    ServerRequest1.RequestHeaders.Clear;
    ServerRequest1.RequestHeaders.Add('Content-Type:application/x-www-form-urlencoded; charset=UTF-8');

    ServerRequest1.Execute;

end;
procedure TForm1.ServerRequest1Complete(Request: TServerRequest);
Var
  Result : String;
begin
  IF ServerRequest1.StatusText = 'OK' Then
  Begin
     Result := ServerRequest1.ResponseContent[0];

     IF Result = 'Hello' Then
     Begin
        Edit1.Text := 'Hello';
     End;
   end;
end;
Wed, May 23 2018 6:38 AMPermanent Link

Chris Holland

SEC Solutions Ltd.

Avatar

Team Elevate Team Elevate

Hi Passquale,

Have you setup the Whitelist in the phonegap config file?

Chris Holland
[Team Elevate]

On 23/05/2018 09:31, Pasquale wrote:
> I'm trying to use the server request with Phonegap. It works on the notebook but not on the smartphone. Why?
> This is a simple test code:
> procedure TForm1.Button1Click(Sender: TObject);
> begin
>       ServerRequest1.URL := './hello.php';
>       
>       ServerRequest1.RequestContent.Clear;
>       ServerRequest1.RequestHeaders.Clear;
>       ServerRequest1.RequestHeaders.Add('Content-Type:application/x-www-form-urlencoded; charset=UTF-8');
>
>       ServerRequest1.Execute;
>
> end;
> procedure TForm1.ServerRequest1Complete(Request: TServerRequest);
> Var
>     Result : String;
> begin
>     IF ServerRequest1.StatusText = 'OK' Then
>     Begin
>        Result := ServerRequest1.ResponseContent[0];
>
>        IF Result = 'Hello' Then
>        Begin
>           Edit1.Text := 'Hello';
>        End;
>      end;
> end;
>
Wed, May 23 2018 10:08 AMPermanent Link

Pasquale

Web Pos srl


I'm using  <access origin="*" /> for access to any server
Wed, May 23 2018 11:30 AMPermanent Link

Uli Becker

Pasquale,

> I'm using  <access origin="*" /> for access to any server

These are the relevant lines I use in my config files:

    <plugin name="cordova-plugin-whitelist" version="1" />
    <access origin="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />

Uli
Image