Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/298.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.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解析返回数字1的电子邮件的XML_Php_Xml_Parsing_Email - Fatal编程技术网

使用PHP解析返回数字1的电子邮件的XML

使用PHP解析返回数字1的电子邮件的XML,php,xml,parsing,email,Php,Xml,Parsing,Email,我正在使用scorm测验,它可以将数据作为xml导出到我的服务器。我正在尝试解析这些数据,以便我可以使用其中的一些数据发送php电子邮件。我现在尝试的是返回数字1,我不知道如何使它工作。帮忙 <?php $version = $_POST['v']; $points = $_POST['sp']; $passing_percent = $_POST['psp']; $gained_score = $_POST['tp']; $username = $_POST['sn']; $email

我正在使用scorm测验,它可以将数据作为xml导出到我的服务器。我正在尝试解析这些数据,以便我可以使用其中的一些数据发送php电子邮件。我现在尝试的是返回数字1,我不知道如何使它工作。帮忙

<?php

$version = $_POST['v'];
$points = $_POST['sp'];
$passing_percent = $_POST['psp'];
$gained_score = $_POST['tp'];
$username = $_POST['sn'];
$email = $_POST['se'];
$quiz_title = $_POST['qt'];
$detailed_results_xml = $_POST['dr'];

$xml_string = <<<_XML
print "<?xml version="1.0" encoding="iso-8859-1"?>" . $detailed_results_xml;
_XML;

$xml = simplexml_load_string($xml_string);
$emailtest = print_r($xml);

mail("email@email.com",$quiz_title,$emailtest,"From: fromname <noreply@test.com>");

?>

如果我通过电子邮件将$detailed_results_xml发送给我自己,它的发送方式如下:

<quizReport xmlns="http://www.ispringsolutions.com/ispring/quizbuilder/quizresults"    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:schemaLocation="http://www.ispringsolutions.com/ispring/quizbuilder/quizresults  quizReport.xsd" version="1">
<quizSettings quizType="survey" timeLimit="0"/>
<summary time="32">
<variables>
  <variable name="USER_NAME" title="Name" value="mike"/>
  <variable name="USER_EMAIL" title="Email" value="test.test@test.com"/>
</variables>
</summary>
  <questions>
     <fillInTheBlankSurveyQuestion id="{BE7284DD-B731-409B-9198-A782499EECA9}" status="answered">
      <direction>Exercise 1: Current Sleep Habits (Night 1)
    In this exercise, think about the last few nights of sleep. Write the amount of time you slept per night and rate the quality of your sleep on a scale of 1 to 5, with 1 being bad and 5 being great. This will give you snapshot of your current sleep habits.
    Example:
    Day of Week
    Sunday
    Time to Bed At Night
    11:30 pm
    Time in Bed Before As!
    leep (estimate)
    1 hour
    Time Awake in the Morning
    6:30 am
    Quality of Sleep (1 to 5)
    3
    Total Time Sleeping
    6 hours </direction>
  <details>
    <text>
      <![CDATA[Day of Week]]>
    </text>
    <blank userAnswer=""/>
    <text>
      <![CDATA[ Time to Bed At Night]]>
    </text>
    <blank userAnswer=""/>
    <text>
      <![CDATA[ Time in Bed Before Asleep (estimate)]]>
    </text>
    <blank userAnswer=""/>
    <text>
      <![CDATA[ Time Awake in the Morning]]>
    </text>
    <blank userAnswer=""/>
    <text>
      <![CDATA[ Quality of Sleep (1 to 5)]]>
    </text>
    <blank userAnswer=""/>
    <text>
      <![CDATA[ Total Time Sleeping]]>
    </text>
    <blank userAnswer=""/>
  </details>
</fillInTheBlankSurveyQuestion>
<fillInTheBlankSurveyQuestion id="{F52AC41C-C149-4B8D-9976-5F380B1A7851}" status="answered">
  <direction>Exercise 1: Current Sleep Habits (Night 2)
    In this exercise, think about the last few nights of sleep. Write the amount of time you slept per night and rate the quality of your sleep on a scale of 1 to 5, with 1 being bad and 5 being great. This will give you snapshot o!
    f your current sleep habits.
    Example:
    Day of Week
    Sunday!

    Time to Bed At Night
    11:30 pm
    Time in Bed Before Asleep (estimate)
    1 hour
    Time Awake in the Morning
    6:30 am
    Quality of Sleep (1 to 5)
    3
    Total Time Sleeping
    6 hours </direction>
  <details>
    <text>
      <![CDATA[Day of Week]]>
    </text>
    <blank userAnswer=""/>
    <text>
      <![CDATA[ Time to Bed At Night]]>
    </text>
    <blank userAnswer=""/>
    <text>
      <![CDATA[ Time in Bed Before Asleep (estimate)]]>
    </text>
    <blank userAnswer=""/>
    <text>
      <![CDATA[ Time Awake in the Morning]]>
    </text>
    <blank userAnswer=""/>
    <text>
      <![CDATA[ Quality of Sleep (1 to 5)]]>
    </text>
    <blank userAnswer=""/>
    <text>
      <![CDATA[ Total Time Sleeping]]>
    </text>
    <blank userAnswer=""/>
  </details>
</fillInTheBlankSurveyQuestion>
<fillInTheBlankSurveyQuestion id="{4F33A341-308C-493E-BF98-E13927064BC5}" status="answered">
  <direction>Exercise 1: Current Sleep Habits (Night 3)
    In this exercise, think about the last few nights of sleep. Write the amount of time you slept per night and rate the quality of your sleep on a scale of 1 to 5, with 1 !
    being bad and 5 being great. This will give you snapshot of your current sleep habits.
    Example:
    Day of Week
    Sunday
    Time to Bed At Night
    11:30 pm
    Time in Bed Before Asleep (estimate)
    1 hour
    Time Awake in the Morning
    6:30 am
    Quality of Sleep (1 to 5)
    3
    Total Time Sleeping
    6 hours </direction>
  <details>
    <text>
      <![CDATA[Day of Week]]>
    </text>
    <blank userAnswer=""/>
    <text>
      <![CDATA[ Time to Bed At Night]]>
    </text>
    <blank userAnswer=""/>
    <text>
      <![CDATA[ Time in Bed Before Asleep (estimate)]]>
    </text>
    <blank userAnswer=""/>
    <text>
      <![CDATA[ Time Awake in the Morning]]>
    </text>
    <blank userAnswer=""/>
    <text>
      <![CDATA[ Quality of Sleep (1 to 5)]]>
    </text>
    <blank userAnswer=""/>
    <text>
      <![CDATA[ Total Time Sleeping]]>
    </text>
    <blank userAnswer=""/>
  </details>
</fillInTheBlankSurveyQuestion>
<fillInTheBlankSurveyQuestion id="{324BFC55-6E6D-48EF-9B0F-341131988317}" status="answered">
  <direction>Exercise 1: Current Sleep Habits (Night 4)
    In this exercise, think about the last few nights!
    of sleep. Write the amount of time you slept per night and rate the qu!
    ality of your sleep on a scale of 1 to 5, with 1 being bad and 5 being great. This will give you snapshot of your current sleep habits.
    Example:
    Day of Week
    Sunday
    Time to Bed At Night
    11:30 pm
    Time in Bed Before Asleep (estimate)
    1 hour
    Time Awake in the Morning
    6:30 am
    Quality of Sleep (1 to 5)
    3
    Total Time Sleeping
    6 hours </direction>
  <details>
    <text>
      <![CDATA[Day of Week]]>
    </text>
    <blank userAnswer=""/>
    <text>
      <![CDATA[ Time to Bed At Night]]>
    </text>
    <blank userAnswer=""/>
    <text>
      <![CDATA[ Time in Bed Before Asleep (estimate)]]>
    </text>
    <blank userAnswer=""/>
    <text>
      <![CDATA[ Time Awake in the Morning]]>
    </text>
    <blank userAnswer=""/>
    <text>
      <![CDATA[ Quality of Sleep (1 to 5)]]>
    </text>
    <blank userAnswer=""/>
    <text>
      <![CDATA[ Total Time Sleeping]]>
    </text>
    <blank userAnswer=""/>
  </details>
</fillInTheBlankSurveyQuestion>
<fillInTheBlankSurveyQuestion id="{96C36841-A582-4059-A408-8D8EA0CC09E6}" status="answered">
  <direction>Exercise 1: Current Sleep Habits (Night 5)
    !
    In this exercise, think about the last few nights of sleep. Write the amount of time you slept per night and rate the quality of your sleep on a scale of 1 to 5, with 1 being bad and 5 being great. This will give you snapshot of your current sleep habits.
    Example:
    Day of Week
    Sunday
    Time to Bed At Night
    11:30 pm
    Time in Bed Before Asleep (estimate)
    1 hour
    Time Awake in the Morning
    6:30 am
    Quality of Sleep (1 to 5)
    3
    Total Time Sleeping
    6 hours </direction>
  <details>
    <text>
      <![CDATA[Day of Week]]>
    </text>
    <blank userAnswer=""/>
    <text>
      <![CDATA[ Time to Bed At Night]]>
    </text>
    <blank userAnswer=""/>
    <text>
      <![CDATA[ Time in Bed Before Asleep (estimate)]]>
    </text>
    <blank userAnswer=""/>
    <text>
      <![CDATA[ Time Awake in the Morning]]>
    </text>
    <blank userAnswer=""/>
    <text>
      <![CDATA[ Quality of Sleep (1 to 5)]]>
    </text>
    <blank userAnswer=""/>
    <text>
      <![CDATA[ Total Time Sleeping]]>
    </text>
    <blank userAnswer=""/>
  </details>
</fillInTheBlankSurveyQuestion>
  <essayQuestion id="{C91C6866!-63A1-4BE5-84DD-1A0F8C34FB1F}" status="answered">
  <direction>Exercise 2:!
    Regulate the Body’s Clock through Daily Routine
    Some people use a morning routine to help them wake up and a bedtime routine of relaxing activities to prepare their bodies for sleep. These activities of daily living act as “cues†to signal the brain to fall into biological rhythms.
    In this exercise, consider for a minute what you did last night before bed and what you’ve done so far today.
    Take a moment to describe your daily routine and activities starting with last night.
    Evening activities at work, school, community or home: </direction>
  <userAnswer>asdfasdf</userAnswer>
</essayQuestion>
  <essayQuestion id="{AFE522F8-6D34-4434-BC41-61E7121615FD}" status="answered">
  <direction>Relaxing activities before bedtime: </direction>
  <userAnswer>asdfsasdf</userAnswer>
</essayQuestion>
  <essayQuestion id="{50E422B5-7705-49D6-9CFC-CF1E97389D10}" status="answered">
  <direction>
  Sleep Routine (time to bed, personal care activities, medication, and time, if awoken): </direction>
  <userAnswer>asdfsdfads</userAnswer>
</essayQuestion>
   <essayQuestion id="{6DF65956-6976-446F-87DD-02CD0A88FA14}" status="answered">
  <direction>Wake up routine (time awake, personal care activities, medication time): </direction>
  <userAnswer>asdfdfasdf</userAnswer>
</essayQuestion>
  <essayQuestion id="{CF38A3C2-E538-41B1-92C1-15011126231D}" status="answered">
  <direction>Morning activities at work, school, community or home: </direction>
  <userAnswer>asdfdfasdf</userAnswer>
</essayQuestion>
  <essayQuestion id="{CAA971E7-4722-4900-9667-4CF7B283A95C}" status="answered">
  <direction>Afternoon activities at work, school, community or home: </direction>
  <userAnswer>asdfasdf</userAnswer>
</essayQuestion>
<essayQuestion id="{2A64580E-A99C-4525-8435-2C57ECCBCEFB}" status="answered">
  <direction>Exercise 3: Planning for Improvement
    In this brief exercise, you’ll consider all that you’ve come to realize about your own habits and routine and take a moment to reflect on some small changes that might!
    benefit you.
    Use the space below to make a short list of small chang!
    es you can make to your own routine that might prevent sleep loss. As you’re doing this, consider some of the following questions:
    What changes, if any, have I made in the past that have worked for me? </direction>
  <userAnswer>asdfsad</userAnswer>
</essayQuestion>
<essayQuestion id="{6EB6CCF7-045A-4E8B-AFA0-794F00FEB658}" status="answered">
  <direction>Are there some changes that have not worked? </direction>
  <userAnswer>asdfsasdf</userAnswer>
</essayQuestion>
<essayQuestion id="{99CBF95D-7427-4999-BF93-6D727D607B0A}" status="answered">
  <direction>A few small changes I can make to improve my sleep and health: </direction>
  <userAnswer>asdfsasdf</userAnswer>
</essayQuestion>
<essayQuestion id="{E3621400-19BD-4200-A8A2-DE6544EFAD65}" status="answered">
  <direction>If I make this change, how might it impact my life/Life Goals? </direction>
  <userAnswer>asdfasdfa</userAnswer>
</essayQuestion>

练习1:当前睡眠习惯(第1晚)
在这个练习中,想想最后几个晚上的睡眠。写下你每晚的睡眠时间,用1到5分对你的睡眠质量进行评分,1分为差,5分为好。这将给你当前睡眠习惯的快照。
例子:
星期中的一天
星期日
晚上该睡觉了
晚上11:30
睡觉前的时间也一样!
leep(估计值)
1小时
早上醒来的时间
上午6:30
睡眠质量(1至5)
3.
总睡眠时间
6小时
练习1:当前睡眠习惯(夜间2)
在这个练习中,想想最后几个晚上的睡眠。写下你每晚的睡眠时间,用1到5分对你的睡眠质量进行评分,1分为差,5分为好。这会给你快照哦!
你目前的睡眠习惯。
例子:
星期中的一天
星期天!
晚上该睡觉了
晚上11:30
睡觉前的卧床时间(估计)
1小时
早上醒来的时间
上午6:30
睡眠质量(1至5)
3.
总睡眠时间
6小时
练习1:当前的睡眠习惯(第三晚)
在这个练习中,想想最后几个晚上的睡眠。写下你每晚的睡眠时间,用1到5分对你的睡眠质量进行评分!
做坏事,做好事。这将给你当前睡眠习惯的快照。
例子:
星期中的一天
星期日
晚上该睡觉了
晚上11:30
睡觉前的卧床时间(估计)
1小时
早上醒来的时间
上午6:30
睡眠质量(1至5)
3.
总睡眠时间
6小时
练习1:当前睡眠习惯(第4晚)
在这个练习中,想想最后几个晚上!
睡眠不足。写下你每晚的睡眠时间,并给qu评分!
你的睡眠质量在1到5分之间,1分为差,5分为好。这将给你当前睡眠习惯的快照。
例子:
星期中的一天
星期日
晚上该睡觉了
晚上11:30
睡觉前的卧床时间(估计)
1小时
早上醒来的时间
上午6:30
睡眠质量(1至5)
3.
总睡眠时间
6小时
练习1:当前睡眠习惯(第5晚)
!
在这个练习中,想想最后几个晚上的睡眠。写下你每晚的睡眠时间,用1到5分对你的睡眠质量进行评分,1分为差,5分为好。这将给你当前睡眠习惯的快照。
例子:
星期中的一天
星期日
晚上该睡觉了
晚上11:30
睡觉前的卧床时间(估计)
1小时
早上醒来的时间
上午6:30
睡眠质量(1至5)
3.
总睡眠时间
6小时
练习2:!
调节身体™他每天都打卡
有些人利用早晨的例行活动来帮助他们醒来,而睡前的例行放松活动则为他们的睡眠做好准备。这些日常生活活动作为“线索”,向大脑发出信号,使其进入生物节律。
在这个练习中,考虑一下你昨晚在睡觉前做了什么和你做了什么。™我今天已经做了很多了。
从昨晚开始,花点时间描述一下你的日常生活和活动。
工作、学校、社区或家中的晚间活动:
asdfasdf
睡前放松活动:
asdfsasdf
睡眠常规(睡觉时间、个人护理活动、药物和醒来时间):
asdfsdfads
唤醒常规(唤醒时间、个人护理活动、用药时间):
asdfdfasdf
工作、学校、社区或家中的晨活动:
asdfdfasdf
工作、学校、社区或家中的下午活动:
asdfasdf
练习3:规划改进
在这个简短的练习中,您™我会考虑你的一切™I’我逐渐意识到你自己的习惯和常规,并花点时间思考一些可能发生的小变化!
对你有好处。
用下面的空格列出小张的简短列表!
你可以在日常生活中做一些可以防止失眠的小动作。如你所愿™再这样做,考虑下面的一些问题:
我过去做过哪些改变,如果有的话,对我有帮助?
asdfsad
是否有一些改变没有奏效?
asdfsasdf
我可以做一些小改变来改善我的睡眠和健康:
asdfsasdf
如果我做出这一改变,它会对我的生活/人生目标产生怎样的影响?
asdfasdfa
很抱歉,如果xml位上的格式被弄乱了,但是我认为您应该从中了解这一点。因此,xml位是由$detailed_results_xml生成的,我需要将它的一些片段解析为html以发送电子邮件,但现在我只看到数字1。非常感谢您的帮助

print\r ret
$emailtest = print_r($xml);
mail("email@email.com", $quiz_title, $xml, "From: fromname <noreply@test.com>");