如何为每个最终答案使用条件决策树抓取AngularJS网站数据?

ken*_*e41 6 php json screen-scraping conditional-statements

给出的例子URL端点像这样,你会怎么去刮最终价格在PHP中的条件,其输出的每个组合到Excel?

我在HTML中找到了json数据并进行了解码,但是混合每个条件并按照其进行操作以得出每个最终总价似乎是一个问题。我曾考虑过使用switch语句,但是通过使用go_to逻辑,他们设法实现了相同数据的副本,因此冒着重复自己的风险。

这是我开始使用switch语句的方式

<?php
  $json = '';


  $json_d = json_decode($json, true);
  foreach($json_d as $s => $set){
    foreach($set['questions'] as $q => $question){
      process_question($question);

    }
  }

  function process_question($question){
    switch ($question['text']) {
      case 'What is the condition of the phone?':
        process_condition();
        break;

      default:
        # code...
        break;
    }
    // foreach($question['answers'] as $a => $answer){
    //   // print_r($answer);
    // }
  }

?>
Run Code Online (Sandbox Code Playgroud)

该特定端点的json块在这里。希望保持职位简短。

如果浏览决策树得出每个最终的总和,您将知道我要实现的意思并将其付诸实践。