Jump to content

Php Sending Post Info


darkgawd

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.