darkgawd Posted December 29, 2009 Share Posted December 29, 2009 I'm trying to submit post data so I can login to a website but I can't figure out why it's not working: ... $f3 = "webpage"; $v3 = "/blah/blah.mc"; $f4 = "ABC|abcabc"; //look at the strange special character (|) of a hidden field with no value $v4 = ""; $postchars = http_build_query( array($f1 => $v1, $f2 => $v2, $f3 => $v3, $f4 => $v4) ); //echo $postchars; $stream = stream_context_create( array('http' => array('method' => 'POST', 'header' => 'Content-Type: application/x-www-form-urlencoded', 'content' => $postchars) ) ); echo file_get_contents($url, false, $stream); There's no javascript or anything being done to the values before being submitted and I've tried to urlencode all post data variables which doesn't fix the problem but does give an error message (usually no error message is given). Anyone got any ideas why it's not working? I'm wondering if it's that strange char or maybe something basic? I'd rather not use curl - this should be able to work. Link to comment https://forums.phpfreaks.com/topic/186617-php-sending-post-info/ Share on other sites More sharing options...
darkgawd Posted December 30, 2009 Author Share Posted December 30, 2009 I've submitted this to a page where I print out all POST variables and the variables are fine. Any idea what the problem could be? Link to comment https://forums.phpfreaks.com/topic/186617-php-sending-post-info/#findComment-985957 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.