Does curl support Javascript or PAC (automated proxy config)?

jackxiang 2012-3-7 16:46 | |
想通过.pac文件用PHP的CURL实现代理可以吗?cURL的FAQ上明确提到这点,是不可能的,呵呵,来自:http://curl.haxx.se/docs/faq.html#Does_curl_support_Javascript_or
-----------------------------------------------
Many web pages do magic stuff using embedded Javascript. Curl and libcurl have no built-in support for that, so it will be treated just like any other contents.

.pac files are a netscape invention and are sometimes used by organizations to allow them to differentiate which proxies to use. The .pac contents is just a Javascript program that gets invoked by the browser and that returns the name of the proxy to connect to. Since curl doesn't support Javascript, it can't support .pac proxy configuration either.

Some workarounds usually suggested to overcome this Javascript dependency:

- Depending on the Javascript complexity, write up a script that
translates it to another language and execute that.

- Read the Javascript code and rewrite the same logic in another language.

- Implement a Javascript interpreter, people have successfully used the
Mozilla Javascript engine in the past.

- Ask your admins to stop this, for a static proxy setup or similar.

。。。

作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:http://jackxiang.com/post/5046/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!

Tags: ,

最后编辑: jackxiang 编辑于2012-3-7 16:47
评论列表
发表评论

昵称

网址

电邮

打开HTML 打开UBB 打开表情 隐藏 记住我 [登入] [注册]