jimmyo Posted March 4, 2009 Share Posted March 4, 2009 Is there a way to POST information to a website using the Header command? I have tried many combinations with no luck. Thanks in advance for any help you can provide. Jim Link to comment https://forums.phpfreaks.com/topic/147900-post-header/ Share on other sites More sharing options...
WolfRage Posted March 4, 2009 Share Posted March 4, 2009 Hey Try This! <?php $data = array ('foo' => 'bar', 'bar' => 'baz'); $data = http_build_query($data); header('Location: http://www.example.com/test.php'); header("Method: POST\r\n"); header ( "Content-type: application/x-www-form-urlencoded\r\n" ); header('Content-Length: ' . strlen($data) . "\r\n"); header('Content:'.$data); ?> Link to comment https://forums.phpfreaks.com/topic/147900-post-header/#findComment-776250 Share on other sites More sharing options...
WolfRage Posted March 4, 2009 Share Posted March 4, 2009 OK so that did not work but some thing similar might. This link is a similar idea, but if you are trying to push the user to another page and POST this technique will not work. Link to comment https://forums.phpfreaks.com/topic/147900-post-header/#findComment-776264 Share on other sites More sharing options...
jimmyo Posted March 4, 2009 Author Share Posted March 4, 2009 Thanks for trying WolfRage - I tried some similar code but also with no luck. What link are you referring to? Link to comment https://forums.phpfreaks.com/topic/147900-post-header/#findComment-776305 Share on other sites More sharing options...
WolfRage Posted March 4, 2009 Share Posted March 4, 2009 http://www.phpfreaks.com/forums/index.php/topic,241471.msg1126387.html#msg1126387 Just note I left out a ";" and I can't put it in the code now. But the code works, just modify for your use. Link to comment https://forums.phpfreaks.com/topic/147900-post-header/#findComment-776343 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.