想通过.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.
。。。
-----------------------------------------------
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.
。。。