dragon0023 2016-10-30 15:35
浏览 46

PHP - 使用不同的端口从8080获取站点内容

I am trying to display text from a url onto another site.

I have used file_get_contents in combo with http://gimmes.net/celtcast/test.txt Which worked! Yay!

But the thing is now, I tried changing it to http://celtcast.gkstreamen.nl:8086/7.html

Which has the values I need, but I ran into a issue, it didn't show what I wanted, well, it showed, nothing.

Which is also no good, I found out that the problem was laying with that the php

couldn't access the other server cos it's not :8080.

I would like some help on how I could make this work; At the end I just need a variable of the text

which is something like '17,1,24,500,16,128,Triakel - Kom blicka in pa en kyrkogard' And I will parse it after that...

Thanks!

  • 写回答

1条回答 默认 最新

  • dourong9253 2016-10-30 15:55
    关注

    Use CURL :

    <?php
    $curl = curl_init('http://celtcast.gkstreamen.nl/7.html'); 
    curl_setopt($curl, CURLOPT_PORT, 8086); 
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 8086); 
    $result = curl_exec($curl); // parse $result then
    ?>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 在获取boss直聘的聊天的时候只能获取到前40条聊天数据
  • ¥20 关于URL获取的参数,无法执行二选一查询
  • ¥15 液位控制,当液位超过高限时常开触点59闭合,直到液位低于低限时,断开
  • ¥15 marlin编译错误,如何解决?
  • ¥15 有偿四位数,节约算法和扫描算法
  • ¥15 VUE项目怎么运行,系统打不开
  • ¥50 pointpillars等目标检测算法怎么融合注意力机制
  • ¥20 Vs code Mac系统 PHP Debug调试环境配置
  • ¥60 大一项目课,微信小程序
  • ¥15 求视频摘要youtube和ovp数据集