且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

CURL获取带有参数的请求,该参数包含GET URL

更新时间:2022-04-20 23:31:01

您需要转义

You need to escape your parameters, the http_build_query function will be useful:

$query = http_build_query([
 'id' => 'http://foo?a=1&b=2',
 'scrape' => true,
 'method' => 'post'
]);

$url = "https://graph.facebook.com/?".$query;

var_dump($url);

这将输出:

https://graph.facebook.com/?id=http%3A%2F%2Ffoo%3Fa%3D1%26b%3D2&scrape=1&method=post