PHP code example of thealgoslingers / autoprice

1. Go to this page and download the library: Download thealgoslingers/autoprice library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

thealgoslingers / autoprice example snippets



thealgoslingers\AutoPrice;

// Usage example
$api_key = 'your_api_key_here'; // api key from ip2location.io

// the default base price is approximately
// or same as 1 USD. So we assume price is 
// being converted from USD 
$base_price = 100.0;//base price to be converted from

$dp = new AutoPrice($api_key, $base_price);
$user_ip = '8.8.8.8';// ip of the user 

echo $dp->calculatePrice($user_ip);