curl_setopt doesnt work with url as a variable

2019-08-12 15:19发布

If i go like this - it works:

curl_setopt($ch, CURLOPT_URL, "http://www.facebook.com/pages/Muzikos-R%C5%ABsys/192813414094112?sk=events");

But if i try this

$url = "http://www.facebook.com/pages/Muzikos-R%C5%ABsys/192813414094112?sk=events";
curl_setopt($ch, CURLOPT_URL, $url);

it returns me a blank page;

Any ideas? Cant find the answer so far...

1条回答
趁早两清
2楼-- · 2019-08-12 15:58

Try this code:

$url = "http://www.facebook.com/pages/Muzikos-R%C5%ABsys/192813414094112?sk=events";
$ch  = curl_init($url);
$res = curl_exec($ch);
查看更多
登录 后发表回答