I'm twiting

访问统计

free counters

file_get_contents和\n的那些事

用file_get_contents去获取一段url的内容,结果总是显示404,实际上页面是存在的。搞了半天不明白,后来发现报错的url后带一个空白,猜想可能是url后面多了\n的话file_get_contents就会报错,就在url上加了个trim,马上就成功了!!-_-这file_get_contents的容错性真是……

Share on Facebook

2 comments to file_get_contents和\n的那些事

  • 还是严格一点好啊,容错性太高对程序员不好:)

  • willin

    我也碰到了一样的问题,不管用file_get_contents还是sock都是得到404面页
    网址是:http://www.21food.cn/news/more_market.jsp?pageNo=2&category=25
    兄弟要是有时间帮着看看哈!
    忘 了说:trim试过了

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>