oceanwap
New Member
- Messages
- 24
- Reaction score
- 0
- Points
- 0
I am developing a mobile site.For this I want to know request headers from visting browsers and want to log them.So I can design a mechanism where I can detect handset browsers name(User agent) and serve content according to this.
As you might know that there are plenty of mobile browsers, along with some transcoders(like "http://m.google.com/gwt/n" and "Opera mini").
Normal phone browsers user-agent can be accessed using $_SERVER['HTTP_USER_AGENT'], but transcoders sends their own headers for example, if I want to know original user-agent of opera mini host, then I need to access different header $_SERVER['HTTP_X_OPERAMINI_PHONE_UA'].and something similar for IP address.
I searched through internet so I got these headers.But there are plenty of mobile networks and 3rd party browsers who are doing this.So it will be good, if I store these headers this server temperoraily and study them on so I can design best detection system.I am using WURFL framework.But it is not good at detecting transcoders(means:- who modify original headers,sometimes mobile networks do this too,like vodaone UK).
So I wrote this to get header info
But neither apache_request_headers() nor getallheaders() is working on my free account.I am new to php programming(only 1 month experience).So I want to know what is the reason behind these functions are unfunctionalty and what could be the solution for my problem.
As you might know that there are plenty of mobile browsers, along with some transcoders(like "http://m.google.com/gwt/n" and "Opera mini").
Normal phone browsers user-agent can be accessed using $_SERVER['HTTP_USER_AGENT'], but transcoders sends their own headers for example, if I want to know original user-agent of opera mini host, then I need to access different header $_SERVER['HTTP_X_OPERAMINI_PHONE_UA'].and something similar for IP address.
I searched through internet so I got these headers.But there are plenty of mobile networks and 3rd party browsers who are doing this.So it will be good, if I store these headers this server temperoraily and study them on so I can design best detection system.I am using WURFL framework.But it is not good at detecting transcoders(means:- who modify original headers,sometimes mobile networks do this too,like vodaone UK).
So I wrote this to get header info
PHP:
<?php
$file_name="welcome.html";
foreach (apache_request_headers() as $name => $value)
{
$body_content=$value;
$fp=fopen($file_name,"a");
fwrite ($fp,$body_content); // entering data to the file
fclose ($fp); // closing the file pointer
chmod($file_name,0777);
}
?>
Last edited: