What are the potential issues when accessing URLs within Docker containers in PHP?

When accessing URLs within Docker containers in PHP, one potential issue is that the container may not have network connectivity to reach the external URLs. This can be solved by ensuring that the Docker container is properly configured with network access, such as by using the `--network` flag when running the container.

// Example PHP code snippet to access a URL within a Docker container
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://example.com');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);

echo $response;