IP address recognition

General questions about NeoAppBuilder - our rapid application development tool for building HTML5, web and mobile apps.

Moderator: Neosoft Support

Locked
User avatar
HackinHoodLogicsTm
Posts: 131
Joined: Wed Aug 28, 2013 7:03 am
Location: Ghana
Contact:

IP address recognition

Post by HackinHoodLogicsTm »

Hi NAB,

Please is it possible to retrieve the IP address from your network and store it in a text field?
Please, any help will be appreciated.

Thanks a lot
I am proud to be a Neobooker!!!
www.neosoftware.com
Special Thanks To
Mr. David Riley
User avatar
anton
Posts: 64
Joined: Fri Oct 19, 2012 9:21 pm

Re: IP address recognition

Post by anton »

js - can not receive this information, it is necessary to use server languages ​​for this. Or use a third-party service:

Go to the next path and write:

Project>Events...>start-up

BeginJS
var script=document.createElement('script');
script.src='http://ip-jobs.staff-base.spb.ru/ip.cgi';
document.getElementsByTagName('head')[0].appendChild(script);
EndJS


Then, at the event, press the button, write:

BeginJS
$rootScope.myip = IP;
EndJS

Thus, you put the IP address of the current user of the page of your program into the variable [myip].
farhad2008
Posts: 62
Joined: Tue Apr 01, 2008 1:15 am
Location: usa
Contact:

Re: IP address recognition

Post by farhad2008 »

not work
The Words I Love You
User avatar
anton
Posts: 64
Joined: Fri Oct 19, 2012 9:21 pm

Re: IP address recognition

Post by anton »

farhad2008 wrote:not work
working
https://youtu.be/SbfaZlrVlP8
farhad2008
Posts: 62
Joined: Tue Apr 01, 2008 1:15 am
Location: usa
Contact:

Re: IP address recognition

Post by farhad2008 »

yes
working for me
thank you
The Words I Love You
User avatar
HackinHoodLogicsTm
Posts: 131
Joined: Wed Aug 28, 2013 7:03 am
Location: Ghana
Contact:

Re: IP address recognition

Post by HackinHoodLogicsTm »

Thank you a lot @anton

This code works perfectly but the only problem I have is that I need the local IP address, not the Public IP Address.
Please, any Idea how?
I am proud to be a Neobooker!!!
www.neosoftware.com
Special Thanks To
Mr. David Riley
User avatar
anton
Posts: 64
Joined: Fri Oct 19, 2012 9:21 pm

Re: IP address recognition

Post by anton »

HackinHoodLogicsTm wrote:Thank you a lot @anton

This code works perfectly but the only problem I have is that I need the local IP address, not the Public IP Address.
Please, any Idea how?
To obtain local IP, you can use the following code:

window.RTCPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection;
var pc = new RTCPeerConnection({iceServers:[]}), noop = function(){};
pc.createDataChannel("");
pc.createOffer(pc.setLocalDescription.bind(pc), noop);
pc.onicecandidate = function(ice){
if(!ice || !ice.candidate || !ice.candidate.candidate) return;
var myIP = /([0-9]{1,3}(\.[0-9]{1,3}){3}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7})/.exec(ice.candidate.candidate)[1];
$rootScope.myIP = myIP;
pc.onicecandidate = noop;
};

!!!!!!!!!!!!!!! Does not work in IE and Edge ... As always ... !!!!!!![/quote]

Tutorial:
https://youtu.be/bGylNJt8KWY
User avatar
HackinHoodLogicsTm
Posts: 131
Joined: Wed Aug 28, 2013 7:03 am
Location: Ghana
Contact:

Re: IP address recognition

Post by HackinHoodLogicsTm »

Thank you @anton. You are Genius :D
I am proud to be a Neobooker!!!
www.neosoftware.com
Special Thanks To
Mr. David Riley
User avatar
HackinHoodLogicsTm
Posts: 131
Joined: Wed Aug 28, 2013 7:03 am
Location: Ghana
Contact:

Re: IP address recognition

Post by HackinHoodLogicsTm »

Ooops the code works well on the browser but when compiled to the android app.

I get this "fd88:4477:7aa7:a800:e07e;xxxxx" instead of the ip.

Please, any ideas why?
I am proud to be a Neobooker!!!
www.neosoftware.com
Special Thanks To
Mr. David Riley
User avatar
anton
Posts: 64
Joined: Fri Oct 19, 2012 9:21 pm

Re: IP address recognition

Post by anton »

HackinHoodLogicsTm wrote:Ooops the code works well on the browser but when compiled to the android app.

I get this "fd88:4477:7aa7:a800:e07e;xxxxx" instead of the ip.

Please, any ideas why?
Excellent. This is IPv6. It turns out that on the android is used not IPv4 and IPv6.
Locked