在php中调用unicode字符url

时间:2015-07-28 15:27:16

标签: php

我打电话给Api发送短信。

以下是我需要拨打的链接

http://login.onlinebusinessbazaar.in/vendorsms/pushsms.aspx?user=xxx&password=xxx1&msisdn=99245xxxxx&sid=xxxx&msg=આપનો સુપુત્ર/સુપુત્રી તા-28-07-2015ના રોજ શાળામાં ગેરહાજર છે&fl=0&dc=8&gwid=2

但是当我通过curl_exec($url)header("location:".$url)

调用此链接时

它会自动转换为

http://login.onlinebusinessbazaar.in/vendorsms/pushsms.aspx?user=xxxx&password=xxx&msisdn=99245xxxxx&sid=xxxx&msg=%26%232694%3B%26%232730%3B%26%232728%3B%26%232763%3B%20%26%232744%3B%26%232753%3B%26%232730%3B%26%232753%3B%26%232724%3B%26%232765%3B%26%232736%3B/%26%232744%3B%26%232753%3B%26%232730%3B%26%232753%3B%26%232724%3B%26%232765%3B%26%232736%3B%26%232752%3B%20%26%232724%3B%26%232750%3B-28-07-2015%26%232728%3B%26%232750%3B%20%26%232736%3B%26%232763%3B%26%232716%3B%20%26%232742%3B%26%232750%3B%26%232739%3B%26%232750%3B%26%232734%3B%26%232750%3B%26%232690%3B%20%26%232711%3B%26%232759%3B%26%232736%3B%26%232745%3B%26%232750%3B%26%232716%3B%26%232736%3B%20%26%232715%3B%26%232759%3B&fl=0&dc=8&gwid=2

我得到了respose从客户端检测到一个潜在危险的Request.QueryString值(msg ="આપ&#2728 ...")。

如果我要复制网址

(http://login.onlinebusinessbazaar.in/vendorsms/pushsms.aspx?user=xxx&password=xxx1&msisdn=99245xxxxx&sid=xxxx&msg=આપનો સુપુત્ર/સુપુત્રી તા-28-07-2015ના રોજ શાળામાં ગેરહાજર છે&fl=0&dc=8&gwid=2)

浏览器它工作正常。先感谢您 。

1 个答案:

答案 0 :(得分:1)

Use urlencode($url) to encode the URL before calling curl_exec().