【问题标题】:Accidental html entities in URL on get request获取请求时 URL 中的意外 html 实体
【发布时间】:2013-12-12 11:07:39
【问题描述】:

我有一个 curl 应用程序,在我的 Web 服务上使用 http post/get 请求。 现在,看看这个请求:

http://www.myws.com/index.php?&param=12345

&para 是这个符号:¶。我想知道这是否就是我的请求不起作用的原因。 我的请求如下所示:

$url = 'http://www.myws.com/index.php?&param=12345';

//if i print $url i see the ¶ instead of &param
//I tried with index.php?&param=12345 and i can see it "ok" on my screen 
//but the request is not working.

curl_setopt($this->ch, CURLOPT_POST, false);
curl_setopt($this->ch, CURLOPT_TIMEOUT, 300);
curl_setopt($this->ch, CURLOPT_URL, $url );
$html = curl_exec($this->ch);

我总是会重定向到主网站,因为该请求不存在。

我该如何解决这个问题? curl 如何查看“请求的 url”?

【问题讨论】:

    标签: php curl get


    【解决方案1】:

    尝试将内部编码设置为 UTF-8?听起来像是编码问题

    mb_internal_encoding("UTF-8");
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-05
      相关资源
      最近更新 更多