Skywalker30 Skywalker30 - 3 years ago 181
PHP Question

setting up CORS with Wordpress

I have a welcome page in my website on Wordpress (that uses php)

I need to allow other websites to access the header.
So,I need to add something like

@header( 'Access-Control-Allow-Origin:' );

Where do I add the header so that the OTHERWEBSITE can access MYWEBSITE's resources?

Expected OUTPUT:
If I use
curl -I -L www.MYWEBSITE/welcome.html
then I need to get the header info

I do not have a header.php page in the resources. Do i need to build one?
Where am I supposed to use it?

Answer Source

With FALSE as second parameters to no allowed overwriting headers

header( 'Access-Control-Allow-Origin:', false );

In general this allow somes domains to access to your ressources (API REST, SOAP, Webservices ...) all sites who need cross site scripting we can talk about google, youtube, twitter, but also private api's ... etc)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download