Ver Mensaje Individual
  #3 (permalink)  
Antiguo 04/06/2010, 05:04
ale_g
 
Fecha de Ingreso: mayo-2006
Mensajes: 119
Antigüedad: 20 años, 4 meses
Puntos: 0
Respuesta: Enviar 2 imágenes con CURL

Hola, gracias por responder...

esto sería correcto?

Código PHP:

$post 
= array();
$post['img[]'] = "@img1.jpg"; 
$post['img[]'] = "@img2.jpg";

$url = "http://www.servidor.com/form2.php";

$ch = curl_init(); // Inicializo el handler de Curl  

curl_setopt($ch, CURLOPT_URL,$url); // Url a donde se va a postea.  
  
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11'); //Seteo el user Agent en este caso es el navegador firefox 2  
  
curl_setopt($ch, CURLOPT_FAILONERROR, 1); //terminar en caso de error  
  
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// Permitir Redirecciones  
  
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // Retornar la pagina de resultados en una variable  
  
curl_setopt($ch, CURLOPT_TIMEOUT, 10); //timeout.  
  
curl_setopt($ch, CURLOPT_POST, 1); // SETEAR el Envio por POST  

curl_setopt($ch, CURLOPT_POSTFIELDS, "from=alejandro&[email protected]&$post"); // datos

$result = curl_exec($ch); // Ejecutar el envio por post.  

curl_close($ch); // Cierro la consulta