Hi,

Originally Posted by
ariefbayu
How do I get phone IP address in S40 WebApps? or if it's not possible, now do I get Nokia proxy IP address?
There is the HTTP_X_Forwarded_For header added by the proxy. This is a pretty official approach with respect to how proxy servers work and the Nokia Web App proxy server is no different. I've set up a very simple phpinfo() page at http://hapnic.com/info.php that will list the variables passed to a remote server. If you create a simple web app to get this then it should display the device's IP address.
A remote script, more advanced than my really simple phpinfo(32), would be able to read the HTTP_X_Forwarded_For header variable and return it back to the client for display. And, if for some unknown reason this header disappears, then you can return the remote_addr header instead. But I am sure it won't disappear.
I've tested the Ajax retrieval of my info page with the following javascript where "info" is the ID of a div in my web app:
Code:
function getInfo() {
var info = document.getElementById('info');
var xmlhttp;
xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", "http://hapnic.com/info.php", false);
xmlhttp.send();
if (xmlhttp.status == 200) {
info.innerHTML = xmlhttp.responseText;
} else {
verse.innerHTML = 'Communication error occurred';
}
}
Regards,
Stephen