tomdchi Posted November 21, 2008 Share Posted November 21, 2008 I have a script that contains: $systemurl = $_POST['systemurl']; this would be just https://domain.com/ later I have: $url = "https://domain.com/includes/api.php"; How would I change one of these so that $url would get info from $systemurl and also have /includes/api.php-i.e., $url = {$systemurl}includes/api.php I have this script working with $url domain completed but this will be used for more than one domain so I need it to pull from the post variable. Quote Link to comment https://forums.phpfreaks.com/topic/133663-syntax-help-with-variable/ Share on other sites More sharing options...
gevans Posted November 21, 2008 Share Posted November 21, 2008 echo $_SERVER['SERVER_NAME']; // will echo your domain www.domain.com echo $_SERVER['PHP_SELF']; // will echo everything else /includes/api.php Quote Link to comment https://forums.phpfreaks.com/topic/133663-syntax-help-with-variable/#findComment-695461 Share on other sites More sharing options...
tomdchi Posted November 23, 2008 Author Share Posted November 23, 2008 The variable in question is from a post that contains the system url not of my server but a remote server from where the post came from. This script uses curl to talk back to the remote site hence the need for it to know where it originated from. When I use $url = "https://remotedomain.com/api.php"; it works fine but I need it to get the url information from the $systemurl variable and append it with /api.php so I can use this script for more than one domain. Can this be done? Quote Link to comment https://forums.phpfreaks.com/topic/133663-syntax-help-with-variable/#findComment-697166 Share on other sites More sharing options...
sasa Posted November 23, 2008 Share Posted November 23, 2008 try <?php $url = "https://remotedomain.com/api.php"; $url = parse_url($url); print_r($url); ?> Quote Link to comment https://forums.phpfreaks.com/topic/133663-syntax-help-with-variable/#findComment-697196 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.