Jump to content


Photo

Sending POST data via fsockopen


  • Please log in to reply
9 replies to this topic

#1 Hamlets666

Hamlets666
  • Members
  • PipPipPip
  • Advanced Member
  • 34 posts

Posted 08 October 2006 - 09:26 AM

<?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); 
} 
?>

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
411 Length Required

Could you help me with this error?  ???

#2 Hamlets666

Hamlets666
  • Members
  • PipPipPip
  • Advanced Member
  • 34 posts

Posted 08 October 2006 - 03:16 PM

Sorry about double post, but do you really could`t help?  :'(

#3 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 08 October 2006 - 03:43 PM

try this ok

example only always backup your own code incase this dosent work.

<?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);
}
?> 

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#4 Hamlets666

Hamlets666
  • Members
  • PipPipPip
  • Advanced Member
  • 34 posts

Posted 08 October 2006 - 03:46 PM

No it wouldn`t work.  :-\ But even thanks for a try  ;)

#5 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 08 October 2006 - 03:51 PM

try it this way then .
<?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); 
} 
?> 

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#6 Hamlets666

Hamlets666
  • Members
  • PipPipPip
  • Advanced Member
  • 34 posts

Posted 08 October 2006 - 03:55 PM

redarrow,  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 Required
nginx/0.4.0


#7 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 08 October 2006 - 04:23 PM

try this please.
<?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); 
} 
?> 

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#8 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 08 October 2006 - 04:31 PM

try my way then.



<?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); 
} 
?> 


Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#9 Hamlets666

Hamlets666
  • Members
  • PipPipPip
  • Advanced Member
  • 34 posts

Posted 09 October 2006 - 12:12 PM

Thanks, redarrow  ;) True Super Guru Now it works  :)

#10 Hamlets666

Hamlets666
  • Members
  • PipPipPip
  • Advanced Member
  • 34 posts

Posted 09 October 2006 - 12:30 PM

Could I ask for some more help? Like - I wanted to use anonymouse.org to send in POST data like this :

<?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);
}
?>

And with this code POST data wasn`t sended :(




EDIT : My error : :-\ I didn`t changed Host: dyzyag.jino-net.ru to anonymouse.org




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users