I'm having trouble working with curl and the headers returned by the servers.
1) My php file on my_website.com/index.php looks like this (cropped version):
<?php $url = 'http://my_content_server.com/index.php'; //Open connection $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //execute post $result = curl_exec($ch); //close connection curl_close($ch); echo $result; ?>
The php file at my_content_server.com/index.php looks like this:
<?php header("HTTP/1.0 404 Not Found - Archive Empty"); echo "Some content > 600 words to make chrome/IE happy......"; ?>
I expect that when I am at my_website.com/index.php, I should get 404, but this does not happen.
What am I doing wrong?
2) Basically I want to achieve:
my_content_server.com/index.php will decide the content type and send the appropriate headers, and my_website.com/index.php should just send the same content type and other headers (along with the actual data) to the browser. But it looks like my_website.com/index.php is writing custom headers? (Or maybe I donβt understand the job).
Regards, In JP
JP19
source share