# Allow CORS - Cross origin resource sharing

> When writing APIs in PHP, you want other domains to access your server and you can enable it on your sever with this simple header:

- Canonical: https://preview.arshadmehmood.com/today-i-learned/php/allow-cross-origin-resource-sharing-cors/
- Section: php
- Author: Arshad Mehmood

When writing APIs in PHP, you want other domains to access your server and you can enable it on your sever with this simple header:

```php
<?php
header('Access-Control-Allow-Origin: *'); 
?>
```

