Page 1 of 1

Error when testing php code on webserver

Posted: Thu Dec 02, 2010 8:18 am
by Tchapman
Hello, brand new to php and trying solve a problem. I have a device that is on wifi that can send info to a webserver and get info back, it is an HTML client. If using this string to the remote once the device opens the DNS at port 80:

GET$/testemail.php?

( $ only adds a space in the wifi radio)

The response from my website is:

[syntax]<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test</title>
</head>
<body>
Hello World</body>
</html> [/syntax]

The code in the actually php file is:

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <title>Test</title>
</head>
<body>
<?php echo "Hello World";
?>
</body>
</html>
But, I want to actually see just the Hello World response, which is the only thing that shows if going to the page in a browser.

Is there something other than GET I should be using? I tried sending the complete URL including /testemail.php but it returns and error.

Thanks

Re: Error when testing php code on webserver

Posted: Thu Dec 02, 2010 1:43 pm
by mikecampbell
I'm not sure I understand, but couldn't you just remove all the HTML from your PHP file so you are left with nothing but this line?

Code: Select all

<?php echo "Hello World";?>

Re: Error when testing php code on webserver

Posted: Thu Dec 02, 2010 2:35 pm
by Tchapman
OK I see what is going on. I tried that idea but in doing so discovered the answer. My wifi device is not an html browser, it is simply displaying all the data that is received from the webserver over UART, so it is not designed to simply show the words "Hello World" as does appear if accessing the same file via a browser. But, if you access the file with a browser, you do see "Hello World' as the web page, and if you look at the raw page source, it is the complete response including all the HTML code. So I can getting the correct response after all, I just have to parse out the info that I want the wifi device to actually get.

Thanks