I create FTP account with the Plesk API. Everything works fine until I add the $name
variable in <name>.$name.</name>
its showed an error:
Response error 1019 You specified incorrect username.
Can anyone suggest me how to pass variable?
<?php
require_once('PleskApiClient.php');
$host = "74.208.10.205";//getenv('REMOTE_HOST');
$login = getenv('REMOTE_LOGIN') ?: 'root';
$password = "********";// getenv('REMOTE_PASSWORD');
$client = new PleskApiClient($host);
$client->setCredentials($login, $password);
$name="finalftp3";
$request = <<<EOF
<packet version="1.6.7.0">
<ftp-user>
<add>
<name>.$name.</name>
<password>dkfje44Fwe345n</password>
<home>/httpdocs/eie4retailers.com/</home>
<create-non-existent>true</create-non-existent>
<quota>10</quota>
<permissions>
<read>true</read>
<write>true</write>
</permissions>
<webspace-id>1</webspace-id>
</add>
</ftp-user>
</packet>
EOF;
$response = $client->request($request);
echo "Response".$response;`echo "Response".$response;
I guess <name>.$name.</name>
should be <name>$name</name>
. You don't need to concat the variable within a heredoc string.