php - server not sending custom header values -


i'm using php 5.2.17 remote page, http requests contains cookie values cookies not delivered destination page.

$url = 'http://somesite.com/'; $opts = array( 'http' => array ( 'header' => array("cookie: field1=value1; field2=value2\r\n") ) ); $context = stream_context_create($opts); echo file_get_contents($url, false, $context); 

can me find problem? note: can't use curl. thanks.

are sure receiving code working properly?

i can example work receiving page echoing:

<?php echo $_cookie['field1'] . '::' . $_cookie['field2']; // returns value1::value2 ?> 

alternatively, site requiring user agent (anything). had problem earlier in reaching wikipedia (not restricted mediawiki software; apparently wikimedia sites). set user_agent property inside 'http' array whatever value want. (however, if happen trying reach wikipedia, might instead try api.php: http://en.wikipedia.org/w/api.php ; if mediawiki site, use same relative path)


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -