Problem with include php file from different domain

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kostasps
Forum Commoner
Posts: 26
Joined: Tue Jan 13, 2009 6:20 am
Location: Thessaloniki Greece

Problem with include php file from different domain

Post by kostasps »

Hallo friends,

I desparate need your help.
Suppose there are two different domains: the http://www.mydomain.com and the http://www.customerdomain.com.
Also suppose that these two domains belong to 2 different servers.
Now in the mydomain.com there is the post.php file and in the customerdomain.com there is the action.php file.

I am trying to execute the post.php file through the action.php file by using the function include("http://www.mydomain.com/post.php").
Unfortunately, this doesn't work because the file i am calling belongs to different domain in a different server.

Is there any way to solve this problem?

Thank you in advance

(I forgot to tell you that these two servers are not mine, so i can not turn "allow_url_fopen" to on)
Eric!
DevNet Resident
Posts: 1146
Joined: Sun Jun 14, 2009 3:13 pm

Re: Problem with include php file from different domain

Post by Eric! »

You can't include() a file that is being served via a html server.

If you can't fopen the url from where you are trying to read those sites, then try cURL to read the contents.
Post Reply