使用響應我在這在同一個PHP文件
第一部分中的一個單一的PHP文件:服務器產生一些輸出。
第二部分:使用服務器生成的輸出並提交信息。
我做了什麼:
文件名:abc.php
<?php
//first part
based on the information here server generates some output say:
111 success: id:104.123/12345678 |value:10000045
//second part
i will be using the output generated in the first part.
what i have done is something like this
$server_said = file_get_contents('http://http://abc.php');
//abc.php is the file name
if (preg_match_all('/104.123\:(\d*)/', $server_said, $matches))
//i want to display only 104.123/12345678 part
{
$input = $matches[1];
}
$xmlfile = '<?xml version="1.0" encoding="UTF-8"?>
<identifier identifierType="id">'.$input.'</identifier>';
?>
錯誤:在$輸入沒有顯示預期的結果,它只是停留爲$輸入
我怎樣才能做到這一點?
我不確定上面寫的代碼可能是錯誤的。
你在哪裏試圖提交信息? – 3emad
@ 3emad ..它是一個服務器,它用一個id來確認..這個id應該嵌入在XML文件中。 –