doudai8083 2013-07-09 20:12
浏览 34

fgets获得的订单数据

So i have this script right here to get data from shoutcast

$fp = @fsockopen("$host", $port, &$errno, &$errstr, 30);
fputs($fp,"GET /admin.cgi?pass=jkl&mode=viewxml HTTP/1.0
User-Agent: XML Getter (Mozilla Compatible)

");
echo '<pre>';

while(!feof($fp)) {
    echo fgetss($fp);

}

fclose($fp); 

Problem is that the data i get is all in one line.. if i try something like this

echo fgetss($fp) . '<BR>';

But it doesn't work..it just echos out
on the HTTP/1.0 200 OK Content-Type:text/xml lines..

I'd like if possible to put the data in an array so i can echo-it out nicely OR echo it out ,but also echo it with the xml thing which is in <> so i know what that value actually represents

This is the only method that works with shoutcast to get data.. so don't tell me to use curl because it just doesn't work..

  • 写回答

1条回答 默认 最新

  • duanlan7239 2013-07-09 20:16
    关注

    First <BR> is not valid tag. It should be <br />. Second, if you want to display the content "by lines" you need to either wrap it in <pre> and </pre> tags (so you get line breaks from server response, or you need to to str_replace(" \", '<br />', $string); (mind the quotes. it matters!)

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度