Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread How To Get String From Call To PHP Script?
Thu, Nov 15 2018 3:32 AMPermanent Link

Frederick Chin

I have the following code in hello.php stored in the IIS directory. IIS is listening at port 8084.

<html>
<head>
 <title>PHP Test</title>
</head>
<body>
<?php echo '<p>Hello World</p>'; ?>
</body>
</html>

With a browser, I type localhost:8084/hello.php and I get "Hello World".

In EWB, I use a TServerRequest and set the URL to "http://localhost:8084/hello.php" and in the OnComplete event of the TServerRequest, I have the following code:-

showmessage(Request.ResponseContent.Text);

When I execute the TServerRequest, I get a blank string. What am I doing wrong here?

--
Frederick
Thu, Nov 15 2018 6:42 AMPermanent Link

D.C.

Hi Frederick,
Try with this:

<?php
   print 'Hello World';
?>

Let out all the html code and use only php.

I don't remeber if the use of print instead of echo is mandatory but in all my php legacy code print is the way to send the output.

Regards
Diego



Frederick Chin wrote:

I have the following code in hello.php stored in the IIS directory. IIS is listening at port 8084.

<html>
<head>
 <title>PHP Test</title>
</head>
<body>
<?php echo '<p>Hello World</p>'; ?>
</body>
</html>

With a browser, I type localhost:8084/hello.php and I get "Hello World".

In EWB, I use a TServerRequest and set the URL to "http://localhost:8084/hello.php" and in the OnComplete event of the TServerRequest, I have the following code:-

showmessage(Request.ResponseContent.Text);

When I execute the TServerRequest, I get a blank string. What am I doing wrong here?

--
Frederick
Thu, Nov 15 2018 11:11 AMPermanent Link

Frederick Chin

Hi D.C.,

/*
Try with this:

<?php
   print 'Hello World';
?>

Let out all the html code and use only php.

I don't remeber if the use of print instead of echo is mandatory but in all my php legacy code print is the way to send the output.
*/

It seems that whether I use "echo" or "print", the string is not returned.

However, I managed to solve the problem as follows:-

1.   Enabled CORS in IIS (Not sure if that solved the problem)
2.   Copied the EWB app to IIS's c:\inetpub\wwwroot directory (The hello.php file is in IIS's directory)
3.   Changed the content folder for EWB server to IIS's c:\inetpub\wwwroot directory

Now, when I call the EWB app from the web browser, "Hello World" is shown!

I wish that EWB server supported PHP as an add-on.

--
Frederick
Image