<?php
$path = preg_replace( '/wp-content.*$/', '', __DIR__ );
require_once( str_replace("wp-content/plugins/inflatableoffice/TentCalcSubmit.php", "wp-load.php", $_SERVER['SCRIPT_FILENAME']) );
$thing = 1;
$page_name = urlencode(get_option("io_pagename"));//'Demo+Rentals+LLC';
$page_name = '&name='.$page_name;
$params = '&elemCTA=1';

//$cust_ip = $_SERVER['REMOTE_ADDR'];
if(!empty($_SERVER['HTTP_CLIENT_IP'])) $cust_ip = $_SERVER['HTTP_CLIENT_IP'];
if(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) $cust_ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
if(!empty($_SERVER['HTTP_X_SUCURI_CLIENTIP'])) $cust_ip = $_SERVER['HTTP_X_SUCURI_CLIENTIP'];
//$ips = explode(',', $cust_ip, 2);
//$cust_ip = urlencode(trim($ips[0]));
//if(strpos($params,'&io_custip=')===FALSE) $params.='&io_custip='.$cust_ip;
if(isset($_COOKIE['guid']) && strpos($params,'&io_custguid=')===FALSE) $params.='&io_custguid='.$_COOKIE['guid'];

$link = 'https://rental.software/quotes/contactme.php?nowrap=1'.$page_name.$params; //live
// $link = 'http://localhost/io/bugs/quotes/contactme.php?nowrap=1'.$page_name.$params; //local testing

$result = wp_safe_remote_post( $link, [
    'body' => array("email" => $_REQUEST["email"])
]);
echo print_r($result, true);
?>

