Hamlets666 Posted October 8, 2006 Share Posted October 8, 2006 [code] <?php $x='name=BLA&pass=BLABLA&about=5c6b6c66&email=blabla@inbox.lv&rass=8013&height=175&mass=80'; $f=fsockopen('dyzyag.jino-net.ru',80,$errno,$errstr,30); if(!$f) { echo "Socket error #$errno: $errstr"; } else { $wr="POST /reg.php HTTP/1.1\r\nHost: dyzyag.jino-net.ru\r\n\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: ".strlen($x)."\r\n\r\n".$x; fputs($f,$wr); while(!feof($f)) { echo fgets($f,1024); } fclose($f); } ?> [/code]And there is error - HTTP/1.1 411 Length Required Server: nginx/0.4.0 Date: Sun, 08 Oct 2006 09:19:14 GMT Content-Type: text/html Content-Length: 180 Connection: close [b]411 Length Required[/b] Could you help me with this error? ??? Quote Link to comment https://forums.phpfreaks.com/topic/23339-sending-post-data-via-fsockopen/ Share on other sites More sharing options...
Hamlets666 Posted October 8, 2006 Author Share Posted October 8, 2006 Sorry about double post, but do you really could`t help? :'( Quote Link to comment https://forums.phpfreaks.com/topic/23339-sending-post-data-via-fsockopen/#findComment-105880 Share on other sites More sharing options...
redarrow Posted October 8, 2006 Share Posted October 8, 2006 try this ok example only always backup your own code incase this dosent work.[code]<?php$x='name=BLA&pass=BLABLA&about=5c6b6c66&email=blabla@inbox.lv&rass=8013&height=175&mass=80';$fp = fsockopen("dyzyag.jino-net.ru", 80, $errno, $errstr, 30);if (!$fp) { echo "$errstr ($errno)<br />\n";} else { $out = "GET / HTTP/1.1\r\n"; $out .= "Connection: Close\r\n\r\n"; fwrite($fp, $out); while (!feof($fp)) { echo fgets($fp, 128); } fclose($fp);}?> [/code] Quote Link to comment https://forums.phpfreaks.com/topic/23339-sending-post-data-via-fsockopen/#findComment-105891 Share on other sites More sharing options...
Hamlets666 Posted October 8, 2006 Author Share Posted October 8, 2006 No it wouldn`t work. :-\ But even thanks for a try ;) Quote Link to comment https://forums.phpfreaks.com/topic/23339-sending-post-data-via-fsockopen/#findComment-105895 Share on other sites More sharing options...
redarrow Posted October 8, 2006 Share Posted October 8, 2006 try it this way then .[code]<?php $x='name=BLA&pass=BLABLA&about=5c6b6c66&email=blabla@inbox.lv&rass=8013&height=175&mass=80'; $j="POST /reg.php HTTP/1.1\r\nHost: dyzyag.jino-net.ru\r\n\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: ".strlen($x)."\r\n\r\n".$x; $f=fsockopen('dyzyag.jino-net.ru',80,$errno,$errstr,30); if(!$f) { echo "Socket error #$errno: $errstr"; } else { $wr= $j; fputs($f,$wr); while(!feof($f)) { echo fgets($f,1024); } fclose($f); } ?> [/code] Quote Link to comment https://forums.phpfreaks.com/topic/23339-sending-post-data-via-fsockopen/#findComment-105898 Share on other sites More sharing options...
Hamlets666 Posted October 8, 2006 Author Share Posted October 8, 2006 redarrow, [i]HTTP/1.1 411 Length Required Server: nginx/0.4.0 Date: Sun, 08 Oct 2006 15:55:08 GMT Content-Type: text/html Content-Length: 180 Connection: close 411 Length Requirednginx/0.4.0[/i] Quote Link to comment https://forums.phpfreaks.com/topic/23339-sending-post-data-via-fsockopen/#findComment-105901 Share on other sites More sharing options...
redarrow Posted October 8, 2006 Share Posted October 8, 2006 try this please.[code]<?php $x='name=BLA&pass=BLABLA&about=5c6b6c66&email=blabla@inbox.lv&rass=8013&height=175&mass=80'; $f=fsockopen('dyzyag.jino-net.ru',80,$errno,$errstr,30); if(!$f) { echo "Socket error #$errno: $errstr"; } else { $wr="POST /reg.php HTTP/1.1\r\nHost: dyzyag.jino-net.ru\r\n";$wr.="Content-Type: application/x-www-form-urlencoded\r\nContent-Length: ".strlen($x)."\r\n\r\n".$x"; fputs($f,$wr); while(!feof($f)) { echo fgets($f,1024); } fclose($f); } ?> [/code] Quote Link to comment https://forums.phpfreaks.com/topic/23339-sending-post-data-via-fsockopen/#findComment-105916 Share on other sites More sharing options...
redarrow Posted October 8, 2006 Share Posted October 8, 2006 try my way then.[code]<?php $x='name=BLA&pass=BLABLA&about=5c6b6c66&email=blabla@inbox.lv&rass=8013&height=175&mass=80'; $f=fsockopen('dyzyag.jino-net.ru',80,$errno,$errstr,30); if(!$f) { echo "Socket error #$errno: $errstr"; } else { $wr="POST /reg.php HTTP/1.1\r\nHost: dyzyag.jino-net.ru\r\n";$wr.="Content-Type: application/x-www-form-urlencoded\r\n";$wr.="User-Agent: Mozilla 4.0\r\nContent-length: ";$wr.=strlen($x)."\r\nConnection: close\r\n\r\n$x";fputs($f,$wr); while(!feof($f)) { echo fgets($f,1024); } fclose($f); } ?> [/code] Quote Link to comment https://forums.phpfreaks.com/topic/23339-sending-post-data-via-fsockopen/#findComment-105918 Share on other sites More sharing options...
Hamlets666 Posted October 9, 2006 Author Share Posted October 9, 2006 Thanks, redarrow ;) [b]True Super Guru [/b] Now it works :) Quote Link to comment https://forums.phpfreaks.com/topic/23339-sending-post-data-via-fsockopen/#findComment-106207 Share on other sites More sharing options...
Hamlets666 Posted October 9, 2006 Author Share Posted October 9, 2006 Could I ask for some more help? Like - I wanted to use anonymouse.org to send in POST data like this :[code]<?php$x='name=BLsAx&pass=BLxAsBLA&about=5c6b6c66&email=blabla@inbox.lv&rass=8013&height=175&mass=80';$f=fsockopen('anonymouse.org',80,$errno,$errstr,30);if(!$f) {echo "Socket error #$errno: $errstr";} else {$wr="POST /cgi-bin/anon-www.cgi/http://dyzyag.jino-net.ru/reg.php HTTP/1.1\r\nHost: dyzyag.jino-net.ru\r\n";$wr.="Content-Type: application/x-www-form-urlencoded\r\n";$wr.="User-Agent: Mozilla 4.0\r\nContent-length: ";$wr.=strlen($x)."\r\nConnection: close\r\n\r\n$x";fputs($f,$wr);while(!feof($f)) {echo fgets($f,1024);}fclose($f);}?>[/code]And with this code POST data wasn`t sended :([b] EDIT :[/b] [i]My error : :-\ I didn`t changed Host: dyzyag.jino-net.ru to anonymouse.org[/i] Quote Link to comment https://forums.phpfreaks.com/topic/23339-sending-post-data-via-fsockopen/#findComment-106214 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.