Я запускаю следующий код, и он показывает мне эту ошибку. Может кто-нибудь сказать мне, почему мой xml дает проблему? Когда я запускаю это в браузере, я получаю:
XML Parsing Error: junk after document element
Когда я запускаю это через Twiilio, я получаю следующую ошибку
parserMessage Error on line 2 of document : Content is not allowed in prolog. <?php header("content-type: text/xml"); echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; require "twilio-php-latest/Services/Twilio.php"; /* Set our AccountSid and AuthToken */ $AccountSid = "xxxxx"; $AuthToken = "xxxx"; include 'db.php'; $caller=$_REQUEST['From']; /* Instantiate a new Twilio Rest Client */ $client = new Services_Twilio($AccountSid, $AuthToken); $from= "+17864310795"; $student_number=substr($caller,1); $db = new PDO("mysql:host=localhost;dbname=xxxx","xxxx","xxxx"); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $studentData=getSingleStudentData($db,$student_number); foreach($studentData as $key=>$val) { $student_id=$val['student_id']; $phone=$val['phone_number']; $status=$val['status']; echo $student_id; // find out last call successfully completed by the student if($status==1) { $progress = getLastActivity($db,$student_id); X X X echo "done with initialize<br/>"; $server= "http://sample.com"; try { $to = '+' . $phone; echo $phone; $questions_id_url='questions_id_0='.$questions_id[0].'&questions_id_1='.$questions_id[1].'&questions_id_2='.$questions_id[2]; $questions_file_url='questions_file_0='.$questions_file[0].'&questions_file_1='.$questions_file[1].'&questions_file_2='.$questions_file[2]; $url = $server.'/startCall.php?call_id='.$call_id.'&phone='.$phone.'&'.$questions_id_url.'&'.$questions_file_url.'&student_id='.$student_id.'&story=' .$story.'&story_id='.$story_id.'&call_number='.$call_number.'&question_number=0&count_english=0&count_hindi=0&insert_receivecall=0'; echo "here"."-----".$url; $client->account->calls->create( "+17864310795", $to, $url, array( 'Method' => "GET", 'FallbackMethod' => "GET", 'StatusCallbackMethod' => "GET", 'Record' => "false", )); } catch (Exception $e) { // log error } } } ?> <Response> <Reject reason="busy"/> </Response>
-parserMessage Error on line 2 of document : Content is not allowed in prolog. <?php header("content-type: text/xml"); echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; require "twilio-php-latest/Services/Twilio.php"; /* Set our AccountSid and AuthToken */ $AccountSid = "xxxxx"; $AuthToken = "xxxx"; include 'db.php'; $caller=$_REQUEST['From']; /* Instantiate a new Twilio Rest Client */ $client = new Services_Twilio($AccountSid, $AuthToken); $from= "+17864310795"; $student_number=substr($caller,1); $db = new PDO("mysql:host=localhost;dbname=xxxx","xxxx","xxxx"); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $studentData=getSingleStudentData($db,$student_number); foreach($studentData as $key=>$val) { $student_id=$val['student_id']; $phone=$val['phone_number']; $status=$val['status']; echo $student_id; // find out last call successfully completed by the student if($status==1) { $progress = getLastActivity($db,$student_id); X X X echo "done with initialize<br/>"; $server= "http://sample.com"; try { $to = '+' . $phone; echo $phone; $questions_id_url='questions_id_0='.$questions_id[0].'&questions_id_1='.$questions_id[1].'&questions_id_2='.$questions_id[2]; $questions_file_url='questions_file_0='.$questions_file[0].'&questions_file_1='.$questions_file[1].'&questions_file_2='.$questions_file[2]; $url = $server.'/startCall.php?call_id='.$call_id.'&phone='.$phone.'&'.$questions_id_url.'&'.$questions_file_url.'&student_id='.$student_id.'&story=' .$story.'&story_id='.$story_id.'&call_number='.$call_number.'&question_number=0&count_english=0&count_hindi=0&insert_receivecall=0'; echo "here"."-----".$url; $client->account->calls->create( "+17864310795", $to, $url, array( 'Method' => "GET", 'FallbackMethod' => "GET", 'StatusCallbackMethod' => "GET", 'Record' => "false", )); } catch (Exception $e) { // log error } } } ?> <Response> <Reject reason="busy"/> </Response>
-parserMessage Error on line 2 of document : Content is not allowed in prolog. <?php header("content-type: text/xml"); echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; require "twilio-php-latest/Services/Twilio.php"; /* Set our AccountSid and AuthToken */ $AccountSid = "xxxxx"; $AuthToken = "xxxx"; include 'db.php'; $caller=$_REQUEST['From']; /* Instantiate a new Twilio Rest Client */ $client = new Services_Twilio($AccountSid, $AuthToken); $from= "+17864310795"; $student_number=substr($caller,1); $db = new PDO("mysql:host=localhost;dbname=xxxx","xxxx","xxxx"); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $studentData=getSingleStudentData($db,$student_number); foreach($studentData as $key=>$val) { $student_id=$val['student_id']; $phone=$val['phone_number']; $status=$val['status']; echo $student_id; // find out last call successfully completed by the student if($status==1) { $progress = getLastActivity($db,$student_id); X X X echo "done with initialize<br/>"; $server= "http://sample.com"; try { $to = '+' . $phone; echo $phone; $questions_id_url='questions_id_0='.$questions_id[0].'&questions_id_1='.$questions_id[1].'&questions_id_2='.$questions_id[2]; $questions_file_url='questions_file_0='.$questions_file[0].'&questions_file_1='.$questions_file[1].'&questions_file_2='.$questions_file[2]; $url = $server.'/startCall.php?call_id='.$call_id.'&phone='.$phone.'&'.$questions_id_url.'&'.$questions_file_url.'&student_id='.$student_id.'&story=' .$story.'&story_id='.$story_id.'&call_number='.$call_number.'&question_number=0&count_english=0&count_hindi=0&insert_receivecall=0'; echo "here"."-----".$url; $client->account->calls->create( "+17864310795", $to, $url, array( 'Method' => "GET", 'FallbackMethod' => "GET", 'StatusCallbackMethod' => "GET", 'Record' => "false", )); } catch (Exception $e) { // log error } } } ?> <Response> <Reject reason="busy"/> </Response>
Я пробовал все, и надеялся, что смогу заметить ошибку