2012-06-24 49 views
-1

我试图使用cURL与代理设置,这是工作正常之前我更改我的密码以使用@标志。php cURL密码包含@

这是我如何定义代理:

curl_setopt($curl, CURLOPT_PROXY, "http://test:[email protected]@10.20.5.15:90"); 

有没有办法使用代理与@符号传递(在我的密码是[email protected]),并获得卷曲工作?

+2

可能想看看:http://stackoverflow.com/questions/648292/escaping-curl-symbol-with-php –

+0

可能的重复[如何使用linux命令行ftp机智哈@签入我的用户名?](http://stackoverflow.com/questions/814322/how-to-use-linux-command-line-ftp-with-a-sign-in-my-username) - 相同方法可以用于密码参数。 – Lix

+0

在询问新问题之前,您应该始终尝试在网站上查找现有帖子。 – Lix

回答

1

您还可以使用40%,而不是 “@”:

curl_setopt($curl, CURLOPT_PROXY, "http://test:test%[email protected]:90"); 但最好使用CURLOPT_USERPWD像@lix说..

1

您可能想尝试使用cURL set_opts方法来设置您的用户名和密码。

CURLOPT_USERPWD
用户名和格式化为密码 “[用户名]:[密码]” 使用 进行连接。

一个例子是这样的 -

curl_setopt($curl, CURLOPT_USERPWD, "test:[email protected]");