Ver Mensaje Individual
  #1 (permalink)  
Antiguo 15/01/2013, 16:11
hermes_patrick
 
Fecha de Ingreso: abril-2006
Ubicación: miraflores
Mensajes: 69
Antigüedad: 18 años
Puntos: 1
Php post http request

Buen día expertos

Estoy intentando enviar un mensaje JSON a un servidor HTTP externo en php usando el metodo POST, nunca he hecho peticiones HTTP, sin embargo he llegado hasta este punto:

--Como aprecian envío el mensaje JSON ya codificado:
Código PHP:
<?php
$host 
="10.10.237.8";
$puerto 21098;
$BUFF 2048;
$socket socket_create(AF_INETSOCK_STREAMSOL_TCP);
$conexion socket_connect($socket$host$puerto);
if(
$conexion)
{
    
$msisdn=$_POST["msisdn"];
    
$mensaje=$_POST["mensaje"];
    
$php_array = array(
    
"numero" => $msisdn,
    
"mensaje" => "$mensaje",
    );
    
$json_array=json_encode($php_array);
    echo 
"Conexion Exitosa, puerto: " $puerto."\n\n";
    echo 
$json_array;
    
socket_write($socket$json_array);

    
$server_response socket_read($socket$BUFF); // Receive the results (if any) from the server
    
$decoded_response json_decode($server_responsetrue); // decode the data received
    
echo $decoded_response['passphrase']; // and spit the results
}
else
{
    echo 
"\nLa conexion TCP no se pudo realizar, puerto: ".$puerto;
}
socket_close($socket);
?>
Sin embargo no tengo la mas minima idea de donde meter esta informacion importante:

Código HTML:
POST /SMBULK/BATCH HTTP/1.0
Authorization: Basic dGVzdDp0ZXN0
Host: 10.10.237.8:21098
Content-Length: 395
User-Agent: Wget/1.12 (solaris2.10)
Content-Type: application/x-www-form-urlencoded
Connection: Keep-Alive
Accept: */*
Preguntas:

- Donde debo incluir dicha información requerida por el servidor http ?
__________________
Patrick:policia: