Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a php script sitting on a webserver. The domain for the server we'll say is 'www.example.com'. We also have a blog. This blog sits on a totally different server, but it accessed via 'www.example.com/blog'. Because these two sites share a domain name, my server looks internally for the feed my script is trying to access. How can I make the server look outside the localhost?

share|improve this question

closed as off topic by Zoredache, mdpc, Khaled, dunxd, Chris S Mar 12 '13 at 15:37

Questions on Server Fault are expected to relate to professional server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

    
How did you manage to do that? –  Michael Hampton Mar 11 '13 at 20:40
    
I'm not really sure how it works to be honest. The blog is hosted by Compendium, a large commercial blog company. Somehow they set things up so that the /blog on the domain goes to their host blog. –  LoneWolfPR Mar 11 '13 at 20:45
    
If you can't describe how this is set up, then perhaps you should share the exact name of the site so that the rest of us can try to figure it out. It will be very close to impossible to give a good answer to the question otherwise. –  Michael Hampton Mar 11 '13 at 20:46
1  
I would gather your web server is setup using a Proxy module or something. As for how you access the blog, it completely depends on how you are accessing the remote system. If you are using CURL under PHP, I would bet you can provide the IP of the blog server, and the hostname, in the HTTP request that you send. –  Zoredache Mar 11 '13 at 21:06
    
After spending a lot of time digging I found it is using a proxy. How would I make the server route this request through the proxy? –  LoneWolfPR Mar 12 '13 at 13:51

1 Answer 1

Ok. So, the answer it turns out wasn't so much a server issue as a php issue. I had to route the php call through Compendium's reverse proxy. It was done like this:

$aContext = array('http'=>array('proxy'=>'tcp://client-proxy.compendiumblog.com:80','request_fulluri'=>true));
$url = "http://www.example.com/blog";
$cxContext = stream_context_create($aContext);
$xml = file_get_contents($url,FALSE,$cxContext);
$xmldoc = new SimpleXMLElement($xml);
share|improve this answer
    
+1 And if it works, you should Accept it. –  msanford Mar 12 '13 at 15:01
1  
It does, and I will. I just have to wait a day. My apologies for posting something that wound up not being a server issue. I really thought it was going to be related to Internal DNS or something. –  LoneWolfPR Mar 12 '13 at 18:33

Not the answer you're looking for? Browse other questions tagged or ask your own question.