0
我想訪問一些使用捲曲的非拉丁字符的網址,問題是當我訪問我沒有得到任何迴應。我的瀏覽器沒有問題訪問他們,我檢查了字符串轉換,似乎我正在訪問 「http://www.linkedin.com/pub/j-rgen-a-tr-ff/7/606/68a」 而我的瀏覽器訪問 「http://se.linkedin.com/pub/j%C3%B6rgen-a-tr%C3%A4ff/7/606/68a」 如何轉換是字符串,所以捲曲成功?Utf-8 url得到捲曲
function hitFormGet($loginURL, $loginFields, $referer,$cookieString)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookies.txt");
//curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
//curl_setopt($ch, CURLOPT_COOKIE,$cookieString);
curl_setopt($ch, CURLOPT_FAILONERROR, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate,sdch');
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
curl_setopt($ch, CURLOPT_HEADER, false);
//curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_USERAGENT, "Googlebot/2.1 (+http://www.googlebot.com/bot.html)");
curl_setopt($ch, CURLOPT_URL, $loginURL.$loginFields);
curl_setopt($ch, CURLOPT_REFERER, $referer);
//curl_setopt($ch, CURLOPT_POSTFIELDS, $loginFields);
$ret = curl_exec($ch);
curl_close($ch);
return $ret;
}
$res=hitFormGet("http://se.linkedin.com/pub/j%C3%B6rgen-a-tr%C3%A4ff/7/606/68a","","","");
我的壞我沒有注意到他們已經返回頭的位置,我期待着HTML重定向。 – Evan 2012-04-26 08:49:48