我有一个运行良好的函数,除非在调度程序中被调用,即使它是完全相同的代码,当我使用调度程序运行它时,我得到一个肥皂错误,我没有得到正常。我花了好几个小时不知道调度程序导致了什么,laravel版本是5.1。
POST: https://{{server}}/connect/token
client_id:
client_secret:
grant_type: client_credentials
scope:
这是代码 - 如果我链接到带有它的页面,但是当尝试从调度程序运行时,我会收到此错误
<?php
namespace App\Console\Commands;
use DB;
use Illuminate\Console\Command;
use App\Classes\ImportexportDomains;
use App\Accounts;
use App\Settings;
use App\Client;
use App\Trunk;
use Carbon\Carbon;
use App\Phone;
use App\Makemodel;
require_once(app_path() . "/kashflow/_include/kashflow.inc.php");
require_once(app_path() . "/kashflow/_include/kashflowinvoice.inc.php");
class BillVoip extends Command {
protected $name = 'bill:voip';
public function fire() {
try {
$parameters['UserName'] = 'accounts@xxx.co.uk';
$parameters['Password'] = 'xxxx';
$kashflow_customer_id = 22766679;
$invoice_number = 1;
$invoice_date = date('Y-m-d');
$due_date = date('Y-m-d', strtotime($invoice_date . '+7 days'));
$ref = '';
// Connect to Kashflow.
$kashflow = new \Kashflow($parameters['UserName'], $parameters['Password']);
// Initialise the invoice.
$invoicekf = new \KashflowInvoice($kashflow_customer_id, $invoice_number, $invoice_date, $due_date, $ref);
$rate = 10;
$quantity = 1;
$nominal_id = 12868556; //nom id for domain renewal
$description = 'Domain Renewal - ';
$invoicekf->addLine($quantity, $rate, 0, 20, $nominal_id, $description);
$response = $kashflow->insertInvoice($invoicekf);
} catch (Exception $e) {
// Damn.
$error = 'There was an error sending invoice to Kashflow: ' . $e->getMessage();
echo $error;
}
}
}