Hi folks, I've been struggling for almost two days but couldn't figure out the exact issue. I've go through documentation and tried several ways to accomplish the task but failed. I need to create an email through Email module using pop function. The email is being created with no errors when I copy and past the below command in shell.
But the same above command does not work when Try to call in with php code. e.x
I've also tried the curl way but really that is also returning false and says access denied though I've generated token in my cpanel.
Code:
uapi --user=username Email add_pop email=user password=12345luggage quota=0 domain=example.com skip_update_db=1
Code:
$process = new Process($command);
$process->run();
dd($process);//Failed to set uid as normal user
PHP:
$curl = curl_init();
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$header[0] = "Authorization: whm user:$token";
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
curl_setopt($curl, CURLOPT_URL, $url);
$result = curl_exec($curl);