WAP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreWAP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old April 11th, 2006, 06:28 PM
askjoe's Avatar
askjoe askjoe is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 487 askjoe User rank is Corporal (100 - 500 Reputation Level)askjoe User rank is Corporal (100 - 500 Reputation Level)askjoe User rank is Corporal (100 - 500 Reputation Level)askjoe User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 25 sec
Reputation Power: 7
WAP/WML headers and site not being displayed.

I am creating a WML/WAP website......the site is to work on PDA's & WAP phones. I am however running into a very serious issue with the header type. Some mobile devices require a text/html, others WML.....so I wrote a function that detects useragent - and it seems to be accurate.....however, on many mobile devices that have odd browsers, the user sees an error when trying to view the page.....on those I must send a text/html header to get it to display but then none of the form processing features on my site work - html doesn't recognize the WML form processing.....how do I get over this hurdle?

Here is how I check for browser useragent with PHP
Code:
function browserCheck() {
	//CHECK FOR BROWSER STATUS HERE
	//$type = 1 - BROWSER IS IE/FIREFOX - TEXT/HTML HEADER SENT
	//$type = 0 - WEB ENABLED PHONE - WAP HEADER SENT
	$ua_info = @get_browser($_SERVER['HTTP_USER_AGENT']);
	if($ua_info && ($ua_info->browser == 'IE' || $ua_info->browser == 'Firefox')) { 
		$type = 1;
	}
	else { 
		$type = 0;
	}
	return $type;
}



Here is how I differentiate the header that is sent:
Code:
 
if(browserCheck() == 0) {
	header("Content-type: text/vnd.wap.wml");
}
else {
	header("Content-type: text/html");
}


It's really important that I figure out how to differentiate between headers because if the mobile device requires a text/html header - then I must use an html form to gather user imput.....if it requires a wap header, then I must use a wap form.....but when I send the wap header on about half of the phones I have tried this on I get a "page cannot be displayed" on the screen.....so any help you guys can provide would be greatly appreciated.


I also don't know if this matters but the WAP pages contains a small jpg logo. Could that have some issue with the header?

Last edited by askjoe : April 11th, 2006 at 06:43 PM.

Reply With Quote
  #2  
Old April 11th, 2006, 07:46 PM
jabba_29's Avatar
jabba_29 jabba_29 is offline
Back in HEL
Dev Shed God 8th Plane (8500 - 8999 posts)
 
Join Date: Feb 2002
Location: Finland
Posts: 8,613 jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)  Folding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner Folder
Time spent in forums: 3 Months 3 Weeks 3 Days 5 h 32 m 57 sec
Reputation Power: 1550
Send a message via ICQ to jabba_29 Send a message via AIM to jabba_29 Send a message via MSN to jabba_29 Send a message via Yahoo to jabba_29 Send a message via Google Talk to jabba_29 Send a message via Skype to jabba_29
Facebook
Hi,

YOu are assuming that people browsing your site are only using IE or Fx when using a web browser? Check to see whether the device accepts html or just wml too.

Code:
$_SERVER['HTTP_ACCEPT']


In fact, I would check that first, then determine what browser (if that is really necessary) the user is browsing with. You can also check whether the device accepts jpg's or not and display accordingly. IIRC, gifs may be a better option (smaller generally anyway).

User agent can be faked (as can most headers)

Give the search button a bit of abuse. This forum provides on or two methods for doing this kind of thing

Hope that helps.
__________________
Cheers,

Jamie


# skiFFie | Home of the 'accessibility module' for Drupal
# Jamie Burns [me] Accessibility Module [drupal]
# guidelines | search | wap resources | not getting help | fold to cure

# Any form of employment is strictly prohibited ......


__________________

Let the might of your compassion arise to bring a quick end
to the flowing stream of the blood and tears .....
Please hear my anguished words of truth.

__________________

Last edited by jabba_29 : April 11th, 2006 at 07:49 PM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreWAP Programming > WAP/WML headers and site not being displayed.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway