PHP's file_get_contents
works fine while not inside of a function. However after moving it to a function and calling that function without any other changes the code stops working.
This (outside of a function) works...
$cpuser = 'exampl';
$cppass = 'PASSWORD';
$cpdomain = 'example.com';
$cpskin = 'darnkids';
$emailname = 'darnkids';
$emaildomain = 'example.com';
$password = 'PASSWORD';
$quota = '0';
$result1 = file_get_contents("https://$cpuser:$cppass@$cpdomain:2083/frontend/$cpskin/mail/doaddpop.html?email=$emailname&domain=$emaildomain&password=$password"a=$quota");
echo $result1;
This same code (inside of a function) does not work...
$cpuser = 'exampl';
$cppass = 'PASSWORD';
$cpdomain = 'example.com';
$cpskin = 'darnkids';
$emailname = 'darnkids';
$emaildomain = 'example.com';
$password = 'PASSWORD';
$quota = '0';
function account_create()
{
$result1 = file_get_contents("https://$cpuser:$cppass@$cpdomain:2083/frontend/$cpskin/mail/doaddpop.html?email=$emailname&domain=$emaildomain&password=$password"a=$quota");
echo $result1;
}
account_create();
I need to be able to capture the response regardless of what it is. Why is file_get_contents
not working while inside a function and how do I get it to work inside of a function?