0
这里是我的API格式:无法获得所需的文本响应
http://api.example.com/balance.php?format=#format&token=#token
//Output text
#username|#balance|#error_code|#resText
这里是我的PHP代码:
<?php
$url="http://api.example.com/balance.php?format=text&token=ExAmPlEToKeN";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPGET, true);
$output = curl_exec($ch);
$balance = $output; /* Help me here to get the balance from the response */
curl_close($ch);
echo "Balance is:".$balance;
?>
这说明:
平衡是:my_username | 500.00 | 0 |成功
但我只需要表现出这样的平衡:
余额为:500.00
请帮帮我!
用'|'分解并得到你需要的东西。 –
我该怎么做?我对这些并不熟悉。@u_mulder –
努力并运用你的优秀解决技巧。 –