IP Address Visitor

Just starting out? Need help? Post your questions and find answers here.
IdeasVacuum
Posts: 143
Joined: Tue Feb 25, 2014 1:27 pm

IP Address Visitor

Post by IdeasVacuum »

How can I use SpiderBasic to get the IP address of someone visiting my Website?
the.weavster
Posts: 220
Joined: Sat Mar 01, 2014 3:02 pm

Re: IP Address Visitor

Post by the.weavster »

I think SpiderBasic is currently client side only so you'd have to do something like a HTTPRequest() to a PHP script to get it.

You can find the necessary PHP here.
IdeasVacuum
Posts: 143
Joined: Tue Feb 25, 2014 1:27 pm

Re: IP Address Visitor

Post by IdeasVacuum »

Thanks for the PHP link. However, PB is effectively client side and it can be used to get the IP address of the User, which is why I thought SB would be similar.

However, given Fred's description of SB, it effectively is more a rival to PB (Fred says it compliments PB), and perhaps as such is not going to be a way to compliment a website. I was hoping to use SB for pop-up forms (visitor info gathering) and messages on my website.

Edit: and to pop-up small applications such as a calculator for engineering.
the.weavster
Posts: 220
Joined: Sat Mar 01, 2014 3:02 pm

Re: IP Address Visitor

Post by the.weavster »

IdeasVacuum wrote:However, given Fred's description of SB, it effectively is more a rival to PB (Fred says it compliments PB)
Sure they can be used in a complementary way, for example now PureBasic has JSON commands you could use it to create a JSON-RPC server and then use SpiderBasic for the front end. More and more HTML5 frameworks are now offering the quality widgets we're used to on desktops, combine those with single page web applications and remote procedure call servers and, certainly within enterprises, you have an efficient way of creating, installing and updating your in-house software.
IdeasVacuum
Posts: 143
Joined: Tue Feb 25, 2014 1:27 pm

Re: IP Address Visitor

Post by IdeasVacuum »

The following scripts can collect a fistful of useful geo data. In the example below it collects just the IP Address.

To get the results displayed on a web page they are 'bound' to HTML. However, what I need to do is collect them for display in a SpiderBasic Window - so how are they extracted?

Code: Select all

EnableJS
       <script src="http://code.angularjs.org/1.2.12/angular.min.js"></script>
       <script src="http://code.angularjs.org/1.2.12/angular-route.min.js"></script>

       <script>
                  var geo = angular.module('geo', [])
                  .controller('geoCtrl', ['$scope', '$http', function($scope, $http) {
                      $http.jsonp('http://ipinfo.io/geo/?callback=JSON_CALLBACK')
                      .success(function(data) {
                           $scope.ip = data.ip;  //IP address
                    });
                  }]);
       </script>
DisableJS
Fred
Site Admin
Posts: 1506
Joined: Mon Feb 24, 2014 10:51 am

Re: IP Address Visitor

Post by Fred »

you should be able to use a global SB variable and refere it as "v_YourVariableName" in the JS
IdeasVacuum
Posts: 143
Joined: Tue Feb 25, 2014 1:27 pm

Re: IP Address Visitor

Post by IdeasVacuum »

...tried that, nothing doing. The vars are named in the Goggle scripts and the callback uses JSONP, which seems to be impenetrable. Certainly need a way to pass vars to scripts and receive values from them.
Post Reply