View Single Post
  #1  
Old 02-17-2010, 06:35 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Sending POST data with TSocket

PHP Code:
function sendPOST(hostportpathdata) {
  
// new socket
  
temp.socket = new TSocket();
  
  
// delimeter
  
temp.delim char(13) @ char(10);
  
  
// connect
  
socket.connect(hostport);
  
  
// headers
  
socket.send("POST " path " HTTP/1.0" delim);
  
socket.send("Host: " host delim);
  
socket.send("User-Agent: Mozilla/4.0 (compatible; euroCenterBot; EuroCenterGServer...lol)" delim);
  
socket.send("Content-Length: " data.length() @ delim);
  
socket.send("Content-Type: application/x-www-form-urlencoded" delim);
  
socket.send(delim);
  
  
// data
  
socket.send(data);
  
  
// wait for the socket to close
  
waitfor(socket"onClose"30);
  
  
/* for debugging
  waitfor(socket, "onReceiveData", 5);
  
  if (socket.error != null) {
    echo("Error: " @ socket.error);
  } else {
    echo("Data:");
    
    for (temp.line : socket.data.tokenize('\n')) {
      echo("  " @ line);
    }
  }*/

Example usage:

PHP Code:
temp.data urlencode("data") @ "=" urlencode("bar");
data @= "&";
data @= urlencode("data2") @ "=" urlencode("foo");

sendPOST("techxonline.net"80"/dosomething.php"data); 
Stefan has to approve each host/port for each server, so good luck with that.
__________________

Last edited by cbk1994; 02-17-2010 at 10:42 AM..
Reply With Quote