Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Webhook XML始终为空_Php_Xml_Api_Recurly_Amazon Lightsail - Fatal编程技术网

Php Webhook XML始终为空

Php Webhook XML始终为空,php,xml,api,recurly,amazon-lightsail,Php,Xml,Api,Recurly,Amazon Lightsail,我正在使用Recury webhooks更新联系人,但XML始终为空,以下是我尝试的内容: $xmlString = file_get_contents('php://input'); $dom = new DomDocument(); $dom->loadXML($xmlString); 但是,当我查看该文件时,它始终为空: $rsn = $dom->getElementsByTagName('successful_payment_notification'); if($rsn-

我正在使用Recury webhooks更新联系人,但XML始终为空,以下是我尝试的内容:

$xmlString = file_get_contents('php://input');
$dom = new DomDocument();
$dom->loadXML($xmlString);
但是,当我查看该文件时,它始终为空:

$rsn = $dom->getElementsByTagName('successful_payment_notification');
if($rsn->length != 0){
  //.. do something
}
但是我注意到$dom总是空的,下面是XML反复发送的内容:

<?xml version="1.0" encoding="UTF-8"?>
<successful_payment_notification>
  <account>
    <account_code>89728427a3caa0b21b2ds31223c0fad6f443b82</account_code>
    <first_name>Michael</first_name>
    <last_name>Scott</last_name>
    <company_name nil="true"></company_name>
    <phone nil="true"></phone>
  </account>
  <transaction>
    <id>467fc116288ab89c8d7c954bbca565a8</id>
    <invoice_id>467fc11613dcd438d4410c4ca0bc03e8</invoice_id>
    <invoice_number_prefix></invoice_number_prefix>
    <invoice_number type="integer">1379</invoice_number>
    <test type="boolean">false</test>
    <voidable type="boolean">false</voidable>
    <refundable type="boolean">true</refundable>
  </transaction>
</successful_payment_notification>

89728427A3CAA0B21B2DS3123C0FAD6F443B82
迈克尔
斯科特
467fc116288ab89c8d7c954bbca565a8
467fc11613dcd438d4410c4ca0bc03e8
1379
假的
假的
真的

allow\u url\u fopen处于启用状态,不确定是什么原因导致此问题,我正在使用AWS Lightsail和Bitnami。

我找到了答案,我将其更改为:

$xml = new SimpleXMLElement(file_get_contents('php://input'));
$data = json_decode(json_encode($xml), true);

switch ($xml->getName()) {
    case "renewed_subscription_notification":
        sendEmail("renewed_subscription_notification");
        break;
}