i need to echo $account into $url so that the url/path is whatever i get from $account plus the extension json. I can’t figure it out with the quotes. i tried single and double quotes but no luck. any ideas?
<?php
$account = $_POST['account'];
$url = 'echo $account.json'; //
$content = file_get_contents($url);
$json = json_decode($content, true);
?>
Like this?
the
.operator is used for string concatenation in php. This means take the value of$accountand append the string.jsonto the end, and store that in the variable$url. The rest of the code looks all right from there. There are a few other ways to do this as well with strings in php, but I find this one simplest.