TCP server command read

Hi!
I use tcp server from GSM… works great but how to read command from client?

i use php script:

<?php
// check if form was submitted
if($_POST['send']){
    // open client connection to TCP server
    if(!$fp=fsockopen('90.134.66.170',80,$errstr,$errno,30)){
        trigger_error('Error opening socket',E_USER_ERROR);
    }
    $message=$_POST['message'];
    // write message to socket server
    fputs($fp,$message);
    // get server response
    //$ret=fgets($fp,1024);
    // close socket connection
    fclose($fp);
    echo '<h1>You entered the following message in
lowercase :'.$ret.'</h1>';
    exit();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>TESTING TCP SOCKET SERVER</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-
8859-1" />
</head>
<body>
<h1>Enter your message here</h1>
<form action="<?php echo $_SERVER['PHP_SELF']?>" method="post">
<input type="text" name="message" size="30" />

<input type="submit" name="send" value="Send Value" />
</form>
</body>
</html>

and i use SIM900 GSM modem GSM GPR SGPS IDE100 v307 library

so i send command from php and i get in arduino tcp server serial monitor
but how get exactly command?

sorry for my english

arduino code:

#include "SIM900.h"
#include <SoftwareSerial.h>
#include "inetGSM.h"

InetGSM inet;

char msg[50];
int numdata;
char inSerial[50];
int i=0;
boolean started=false;
long lasttime=millis();
void setup() 
{
  
  Serial.begin(9600);
  Serial.println("GSM Shield testing.");
  
  if(gsm.begin(2400)){
    Serial.println("\nstatus=READY"); 
  }else{
    Serial.println("\nstatus=IDLE");
  }
  
  if (inet.attachGPRS(" ", " ", " ")){
    Serial.println("status=ATTACHED"); 
  }else{
    Serial.println("status=ERROR"); 
  }
    
  gsm.SimpleWriteln("AT+CIFSR");
  delay(5000);
  gsm.WhileSimpleRead();
  sendData();
     //Read IP address.
    gsm.SimpleWriteln("AT+CIFSR");
    delay(5000);
    int i=0;
    while(i<20){
      gsm.SimpleRead();
      i++;
    }

    //TCP Server. Start the socket connection
    //as server on the assigned port.
    Serial.println(msg);
    delay(5000);
    if (inet.connectTCPServer(80))
      Serial.println("status=TCPSERVERWAIT");
    else Serial.println("ERROR in Server");
    lasttime=millis();
}

void sendData(){
 numdata=inet.httpPOST("www.klondaikas.lt", 80, "/ip.php", "testas=asd", msg, 50);
  Serial.println("\nNumber of data received:");
  Serial.println(numdata);  
  Serial.println("\nData received:"); 
  Serial.println(msg);
  
}

void loop(){
  if(started){
    //Check if there is an active connection.
    if (inet.connectedClient()){
      //Read and print the last message received.
      gsm.read(msg, 50);
      Serial.println(msg);
    }
  }
  else{
    serialhwread();
    serialswread();
  }
};

void serialhwread(){
  i=0;
  if (Serial.available() > 0){            
    while (Serial.available() > 0) {
      inSerial[i]=(Serial.read());
      delay(10);
      i++;      
    }
    
    inSerial[i]='\0';
    if(!strcmp(inSerial,"/END")){
      Serial.println("_");
      inSerial[0]=0x1a;
      inSerial[1]='\0';
      gsm.SimpleWriteln(inSerial);
    }
    //Send a saved AT command using serial port.
    if(!strcmp(inSerial,"TEST")){
      Serial.println("SIGNAL QUALITY");
      gsm.SimpleWriteln("AT+CSQ");
    }
    //Read last message saved.
    if(!strcmp(inSerial,"MSG")){
      Serial.println(msg);
    }
    else{
      Serial.println(inSerial);
      gsm.SimpleWriteln(inSerial);
    }    
    inSerial[0]='\0';
  }
}

void serialswread(){
  gsm.SimpleRead();
}

Someone?