Created
          July 31, 2018 09:46 
        
      - 
      
- 
        Save salehahmadbabu/1ac208a02c3ce44b74c4abf968859e41 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <script> | |
| // auto fill form values | |
| jQuery('.pef-title').val(jQuery('.product-title-content').text()); | |
| jQuery('.pef-url').val(window.location.href); | |
| // auto fill form values | |
| jQuery('#productname').val("<?php the_title(); ?>"); | |
| jQuery('#pageurl').val(window.location.href); | |
| // jQuery('#userip').val("<?php// echo $_SERVER['REMOTE_ADDR']; ?>"); | |
| //var IpAddress = $_SERVER['REMOTE_ADDR']; | |
| <?php // ip = 8.8.8.8 | |
| function ip_details($IPaddress) | |
| { | |
| $json = file_get_contents("http://ipinfo.io/{$IPaddress}"); | |
| $details = json_decode($json); | |
| return $details; | |
| } | |
| $ip = $_SERVER['REMOTE_ADDR']; | |
| $details = ip_details("$ip"); | |
| $country_names = json_decode(file_get_contents("http://country.io/names.json"), true); | |
| $country = $country_names[$details->country]; | |
| ?> | |
| var country = "<?php echo $country; ?>"; | |
| console.log(country); | |
| jQuery('input[name=CountryName]').val(country); | |
| </script> | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment