php file_get_contents and &

后端 未结 7 2142
误落风尘
误落风尘 2020-12-07 00:48

I\'m trying to use php\'s file_get_content(\'a url\');

The thing is if the url has \'&\' in it, for example

file_get_contents(\'http://www.google.c

7条回答
  •  不思量自难忘°
    2020-12-07 01:10

    You should try looking at the CURL libraries in PHP that would allow you to do something like:

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "http://mysite.com/file.php?blah=yar&test=blah");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $data = curl_exec($ch);
    curl_close($ch);
    

    You can then get the results from $data.

提交回复
热议问题