curl_setopt does not使用url作为一个变量 [英] curl_setopt doesnt work with url as a variable
本文介绍了curl_setopt does not使用url作为一个变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我这样走 - 它的工作原理:
If i go like this - it works:
curl_setopt($ch, CURLOPT_URL, "http://www.facebook.com/pages/Muzikos-R%C5%ABsys/192813414094112?sk=events");
但如果我尝试这个
$url = "http://www.facebook.com/pages/Muzikos-R%C5%ABsys/192813414094112?sk=events";
curl_setopt($ch, CURLOPT_URL, $url);
它返回一个空白页;
任何想法?到目前为止找不到答案...
Any ideas? Cant find the answer so far...
推荐答案
请尝试以下代码:
$url = "http://www.facebook.com/pages/Muzikos-R%C5%ABsys/192813414094112?sk=events";
$ch = curl_init($url);
$res = curl_exec($ch);
这篇关于curl_setopt does not使用url作为一个变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文