douyingmou1389 2010-05-21 09:22
浏览 148
已采纳

file_get_contents()没有返回?

why i not getting return on file_get_contents($myurl) but i do get output for wget

updated:

i use curl to get the return header and result and discovery that the it is on the header instead in of the body

HTTP/1.1 200 Document follows
Transfer-Encoding: chunked
Content-type: text/plain
Server: XMS (724Solutions HTA XSAM_30_M2_B020 20070803.172831)
Date: Fri, 21 May 2010 10:48:31 GMT
Accept-Ranges: bytes

HTTP/1.1 404 ChargedPartyNotAvailable
Transfer-Encoding: chunked
Content-type: text/plain
Server: XMS (724Solutions HTA XSAM_30_M2_B020 20070803.172831)
Date: Fri, 21 May 2010 10:34:13 GMT
Accept-Ranges: bytes

How can i extract out only "200 Document Follow" and "404 ChargedPartyNotAvailable" ?

  • 写回答

3条回答 默认 最新

  • doufa5001 2010-05-21 09:30
    关注

    Do you have allow_url_fopen enabled in your php configuration?

    However I would expect that you would get a warning generated if not - do you have errors/warnings displayed? You could add temporarily at the top of your script :

    error_reporting(E_ALL);
    ini_set('display_errors', true);
    

    and then you might see why file_get_contents() doesn't work.

    Edit

    You might just be able to use get_headers() if you're only interested in headers.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统