包括PHP文件:cURL,Pathing和Security Risks

So I have heard a lot about cURL having security risks. I need to know if what I am doing can have security risks, and if so, how can I prevent it.

I have my own VPS (Virtual Private Server) through Host Gator.

Basically I am trying to include a file from a different domain. Both domains are in the same server. I tried to use the absolute path to include the file, but I keep getting a permission denied error.

This is my code to include the file using cURL:

$url = "http://mydomain.com/include.php";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);

Is there a security risk doing this? If so, how can I prevent this security risk?

In addition, how can I set permissions on the domain so I can include a PHP file from another domain on the same server?

If you're loading data from different domain but same server you can simply use include and path but you can neither grab php file with url nor its recommended.