Time to bother all of you PHP experts again.
Today my question is about the correct way to extract a CONTENT TYPE from the Client HTTP request Header.
I tried using $_SERVER['CONTENT_TYPE'] and that didn't return anything to me when i tried echo-ing it.
Can anyone help me on this one and tell me the way to extract such information?
Regards
Mian
Extracting content type from client HTTP request
Moderator: General Moderators
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
content-type isn't sent in the client request, that I remember. Accept types may be passed however.. check the output of
Code: Select all
<?php echo '<pre>'.print_r($_SERVER,true).'</pre>'; ?>What is print_r()?
This is my output
Warning: Wrong parameter count for print_r() in /home/myleow/public_html/syncml/index.php on line 3
Warning: Wrong parameter count for print_r() in /home/myleow/public_html/syncml/index.php on line 3
Oh it works without the TRUE arguement.
just $_SERVER is enough.
This is what i got.
Well i don't see any thing related to content type and majority of the information are of the server, except for HTTP_USER_AGENT.
What i am trying develop is a SyncML server that can communicate with my Sony Ericsson T 616.
I don't know which port the phone is trying to communicate with, i assume that it is trying to communicate with port 80 because SyncML has HTTP binding.
[Edit: Added CODE tags for eyecandy. --JAM]
just $_SERVER is enough.
This is what i got.
Code: Select all
Array ( їDOCUMENT_ROOT] => /var/www їHTTP_ACCEPT] => */* їHTTP_ACCEPT_ENCODING] => gzip, deflate їHTTP_ACCEPT_LANGUAGE] => en-us їHTTP_CONNECTION] => Keep-Alive їHTTP_HOST] => pc6.homelinux.com їHTTP_USER_AGENT] => Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322) їPATH] => /bin:/usr/bin:/sbin:/usr/sbin їREMOTE_ADDR] => 63.202.21.11 їREMOTE_PORT] => 61036 їSCRIPT_FILENAME] => /home/myleow/public_html/syncml/index.php їSERVER_ADDR] => 192.168.1.101 їSERVER_ADMIN] => webmaster@icees.com їSERVER_NAME] => www.icees.com їSERVER_PORT] => 80 їSERVER_SIGNATURE] =>
Apache/1.3.26 Server at www.icees.com Port 80
їSERVER_SOFTWARE] => Apache/1.3.26 (Unix) Debian GNU/Linux PHP/4.1.2 їUNIQUE_ID] => QPchIX8AAAEAAHjWJt0 їGATEWAY_INTERFACE] => CGI/1.1 їSERVER_PROTOCOL] => HTTP/1.1 їREQUEST_METHOD] => GET їQUERY_STRING] => їREQUEST_URI] => /~myleow/syncml/index.php їSCRIPT_NAME] => /~myleow/syncml/index.php їPATH_TRANSLATED] => /home/myleow/public_html/syncml/index.php їPHP_SELF] => /~myleow/syncml/index.php їargv] => Array ( ) їargc] => 0 )
1What i am trying develop is a SyncML server that can communicate with my Sony Ericsson T 616.
I don't know which port the phone is trying to communicate with, i assume that it is trying to communicate with port 80 because SyncML has HTTP binding.
[Edit: Added CODE tags for eyecandy. --JAM]
http://www.openmobilealliance.org/tech/ ... t-type.htm
?
Don't think (not entirely sure tho) that you will find this in the global $_SERVER. You should rather lookup the type using the Whitepaper (PDF) or massive googling.
?
Don't think (not entirely sure tho) that you will find this in the global $_SERVER. You should rather lookup the type using the Whitepaper (PDF) or massive googling.