Php 无法发送与+;通过curl post兑换($currency=A&;otherkey=B)
我在关于curl处理的POST字符串中遇到了问题,我得到的是sunny character- 我的问题是: 如何发送 ['货币'=>'somevalue','otherkey'=>'othervalue'] 通过卷曲使用POST 我试图把我的职位安排为Php 无法发送与+;通过curl post兑换($currency=A&;otherkey=B),php,curl,post,currency,ampersand,Php,Curl,Post,Currency,Ampersand,我在关于curl处理的POST字符串中遇到了问题,我得到的是sunny character- 我的问题是: 如何发送 ['货币'=>'somevalue','otherkey'=>'othervalue'] 通过卷曲使用POST 我试图把我的职位安排为 $post_val=“otherVal=1¤cy=USD” 或 $post_val=“otherVal=1&;currency=USD” 或 $post_val=urlencode(“otherVal=1&;currenc
$post_val=“otherVal=1¤cy=USD”代码>
或
$post_val=“otherVal=1&;currency=USD”代码>
或
$post_val=urlencode(“otherVal=1&;currency=USD”)代码>
然后
curl_setopt($ch,CURLOPT_POSTFIELDS,$post_val);
奇怪的是,当我将currency作为字符串中的第一个传递时,它给出了相同的效果——“currency=USD&otherVal=1”
我也试过了
$array=http\u build\u查询(['currency'=>'somevalue','otherkey'=>'othervalue'])代码>
curl\u setopt($ch,CURLOPT\u POSTFIELDS,$array)代码>
也许curl总是进行http\u build\u查询,这也给出了一些源服务器无法正确解释的额外迹象
有什么办法解决吗
干杯简单的出路
$data = array('otheritem'=>'item', 'currency'=>'usd');
curl_setopt($ch, CURLOPT_POST,TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
这应该是一个简单的解决办法
$data = array('otheritem'=>'item', 'currency'=>'usd');
curl_setopt($ch, CURLOPT_POST,TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
这应该是可行的¤代码>转换为货币符号·。但是当&货币
甚至&;货币
翻译成相同的符号,这确实有点奇怪。您是否在服务器端的$\u POST
数组中看到此符号?您是否尝试过$POST\u val=array('otherVal'=>1,'currency'=>'USD')代码>?不幸的是,我对服务器端没有深入了解。我只是总结一下效果。发送一个post值->正确,发送少量->错误。¤代码>转换为货币符号·。但是当&货币
甚至&;货币
翻译成相同的符号,这确实有点奇怪。您是否在服务器端的$\u POST
数组中看到此符号?您是否尝试过$POST\u val=array('otherVal'=>1,'currency'=>'USD')代码>?不幸的是,我对服务器端没有深入了解。我只是总结一下效果。发送一个post值->正确,发送少量->错误。