【发布时间】:2014-06-12 06:21:11
【问题描述】:
我正在尝试使用 cURL 访问一组 URL。部分链接如下所示:
http://somelink.com/directory/file name.php
http://somelink.com/file name.php
http://somelink.com/(some file).txt
http://somelink.com/directory/random chars &^%.txt
http://somelink.com/!@#$%^&*.txt
只是一些带有一些随机字符的文件。我知道有 urlencode() 函数,但是这个函数还对每个目录后的 http:// 和 / 进行 url 编码,这将不允许页面在 cURL 中正确加载。是否有一些正则表达式可用于分隔每个 / 之后的单词并单独对其进行编码,但忽略根目录 / 之前所有内容的编码?
【问题讨论】: