Foros del Web » Programando para Internet » PHP »

[SOLUCIONADO] Ejecutar otro PHP luego del POST...

Estas en el tema de Ejecutar otro PHP luego del POST... en el foro de PHP en Foros del Web. Me cuesta algo explicarme bien en el titulo pero lo que necesito es lo siguiente... Tengo un form que envia un mail, bueno pues hasta ...
  #1 (permalink)  
Antiguo 22/05/2013, 12:24
 
Fecha de Ingreso: octubre-2010
Mensajes: 136
Antigüedad: 13 años, 6 meses
Puntos: 4
Ejecutar otro PHP luego del POST...

Me cuesta algo explicarme bien en el titulo pero lo que necesito es lo siguiente...
Tengo un form que envia un mail, bueno pues hasta ahi vamos bien, pero necesito que luego o mientras envía cae al send.php, me corra newsApi.php con los mismo valores...les dejo mis codes...
Código PHP:
<?php

$to  
'[email protected]', '// note the comma
$to .= "$email";

$nombre $_POST['nombre'];
$email $_POST['email'];
$telefono $_POST['telefono'];
$title = @$_POST["title"];
$text = @$_POST["text"];
$memo $_POST['memo'];

$thank="thanks.html";

$message "
<p><strong>Nombre:</strong> " 
.$name."</p>
<p><strong>E-mail:</strong> " 
.$email."</p>
<p><strong>Telefono:</strong> "
.$telefono."</p>
<p><strong>Producto:</strong> "
.$title."</p>
<p><strong>Informacion del producto:</strong>&nbsp;<br> "
.$text."</p>
<strong>Mensaje:</strong> " 
.$memo."";

$headers  'MIME-Version: 1.0' "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' "\r\n";
$headers .= "From: " .$email;

if (
mail($to,$email,$message,$headers))
Header ("Location: $thank");

?>
Necesito que los mismos valores se envien simultaneamente por este otro code...es decir en la misma acción...
Código PHP:
<?php


error_reporting
(E_ALL);
ini_set('display_errors''1');

$API_KEY_ID     'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$API_KEY_SECRET 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$FORM_ID        'xxxxxxxxx';

/*

Example 1: Inserting or updating one address into your mailing list

*/

$telefono $_POST['telefono'];
$nombre $_POST['nombre'];
$iemail $_POST['email'];
$url   "https://secure.directmailmac.com/api/v1/forms/$FORM_ID/addresses/" urlencode$iemail );
$body  = array(
    
"create_if_necessary" => true,
    
"address" => array( 
        
"Nombre:" => $nombre,
        
"Telefono:" => $telefono,
        
"custom" => array( "1" => "[Nombre]""2" => "[Telefono]" )
    )
);

print_rexecute_api_request"PUT"$url$body ) );

function 
execute_api_request$method$url$body null )
{
    global 
$API_KEY_ID$API_KEY_SECRET;
    
$decoded_response NULL;
        
    
$ch curl_init$url );

    
curl_setopt$chCURLOPT_CUSTOMREQUEST$method );
    
curl_setopt$chCURLOPT_HTTPAUTHCURLAUTH_BASIC );
    
curl_setopt$chCURLOPT_USERPWD"$API_KEY_ID:$API_KEY_SECRET" );
    
curl_setopt$chCURLOPT_RETURNTRANSFER);

    if ( 
$body ) {
        
curl_setopt$chCURLOPT_POSTFIELDSjson_encode$body ) );
    }

    try {
        
$response curl_exec$ch );

        if ( 
$response === false ) {
            
error_logsprintf"Request failed %s %s: %s (%d)\n"$method$urlcurl_error$ch ), curl_errno$ch ) ) );
        }
        else if ( 
$response ) {
            
$decoded_response json_decode$responsetrue );
            
            if ( 
$decoded_response === null ) {
                
error_log"Unable to decode JSON $response" );
            }
        }

    }
    catch ( 
Exception $e ) {
        
error_log"Caught exception while requesting $method $url: " $e->getMessage() );
    }

    
curl_close$ch );
    
    return 
$decoded_response;
}

?>
En general la idea es lograr 2 actions simultaneos...
__________________
Ser o conocer ese es el dilema...
  #2 (permalink)  
Antiguo 22/05/2013, 12:49
 
Fecha de Ingreso: febrero-2013
Mensajes: 163
Antigüedad: 11 años, 2 meses
Puntos: 1
Respuesta: Ejecutar otro PHP luego del POST...

creo que aquí tienes la solución: http://www.forosdelweb.com/f4/mandar...aginas-985489/

Etiquetas: html
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 04:45.