Jump to content

PHP header help!


MetalSmith

Recommended Posts

Hi all I am trying to get this php page to refresh every 5 seconds on my phone which is an aastra 480i IP desk phone.

 

The code below the header line displays a menu on my phone. That works fine so no need to look at that. I am having trouble getting the refresh line to work. How would I make a header for this script with the header line being used below? The header line is in the correct format but I don't know how to apply it.

 

<?php

 

header("Refresh: 5; url= http://XXX.XXX.XXX.XXX/this-page.php”);

 

$textmenu = "<AastraIPPhoneTextMenu style = \"numbered\">\n";

$textmenu .= "<Title>------- Menu -------</Title>\n";

 

$textmenu .= "<MenuItem>\n";

$textmenu .= "<Prompt>Directory</Prompt>\n";

$textmenu .= "<URI>http://192.168.1.102/aastra/directory.php</URI>\n";

$textmenu .= "</MenuItem>\n";

 

$textmenu .= "<SoftKey index = \"1\">\n";

$textmenu .= "<Label>Select</Label>\n";

$textmenu .= "<URI>SoftKey:Select</URI>\n";

$textmenu .= "</SoftKey>\n";

 

$textmenu .= "<SoftKey index = \"6\">\n";

$textmenu .= "<Label>Exit</Label>\n";

$textmenu .= "<URI>SoftKey:Exit</URI>\n";

$textmenu .= "</SoftKey>\n";

 

$textmenu .= "</AastraIPPhoneTextMenu>\n";

 

echo $textmenu;

 

?>

Link to comment
Share on other sites

your page doesn't refresh then?  what's happening?  errors?

 

to point out the obvious, your closing double-quote is incorrect in the header() .. should be " and not ”

 

if you simply want the page to refresh every x seconds, make the correction as i already pointed out and should be fine.  unless i'm just not understanding.

Link to comment
Share on other sites

Well the menu is just an example not to give out to much detail of the real page to be refreshed.

 

The timeout is how often the page is refreshed and not how long it takes to refresh the page. The page loads instantly its just a tiny amount of text.

 

The phone has a default timeout of 45 seconds on all XML pages. I just wanted the user to get to a certain page and have it refresh until he is done with it and then he has to manually close it.

 

The phone manual does not give any examples on how to use it so I am kinda stuck and because its a phone and not a browser this makes things more difficult for posting on forums hehehe.

Link to comment
Share on other sites

The timeout is how often the page is refreshed and not how long it takes to refresh the page. The page loads instantly its just a tiny amount of text.

 

i understand how the function works.

 

this works, which is why i never pointed out the space earlier:

 

header("Refresh: 5; url=                   http://www.yahoo.com");

 

so i don't know what was going on with your code.

Link to comment
Share on other sites

The timeout is how often the page is refreshed and not how long it takes to refresh the page. The page loads instantly its just a tiny amount of text.

 

i understand how the function works.

 

this works, which is why i never pointed out the space earlier:

 

header("Refresh: 5; url=                   http://www.yahoo.com");

 

so i don't know what was going on with your code.

 

But remember, he mentioned it's his phone, so you can safely assume it is less robust at fixing typos as so.

Link to comment
Share on other sites

The timeout is how often the page is refreshed and not how long it takes to refresh the page. The page loads instantly its just a tiny amount of text.

 

i understand how the function works.

 

this works, which is why i never pointed out the space earlier:

 

header("Refresh: 5; url=                   http://www.yahoo.com");

 

so i don't know what was going on with your code.

 

But remember, he mentioned it's his phone, so you can safely assume it is less robust at fixing typos as so.

 

quite true.  point taken.

Link to comment
Share on other sites

Aagin thanks for all the help!

 

One quick follow up question. Can you pass variables with a header?

 

header("Refresh: 15; url=http://192.168.1.102/aastra/details.php?bridge=1");

 

 

 

I have a GET command on the page as well:

 

$bridge = "{$_GET['bridge']}";

Link to comment
Share on other sites

$bridge = "{$_GET['bridge']}";

 

you do not need to surround $_GET['bridge'] with "" .. this is easier:

 

$bridge = $_GET['bridge'];

 

the {} used are used to "explicitly specify the end of the name.", and are not of mandatory usage within HEREDOC and NOWDOC syntax's.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.