<?php 

// was used when API address moved but apps were live on app store.

$ch = curl_init();

$path = $_SERVER['REQUEST_URI'];
$path = str_replace('/api/index.php','',$path);
$path = str_replace('/api/','/',$path);


/* Forward POST on to new API: */
curl_setopt($ch, CURLOPT_URL, 'https://[youraddress.com]/api.php'.$path);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($_POST));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($ch);

exit;