Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/04/2009, 17:17
svengel
 
Fecha de Ingreso: julio-2007
Ubicación: México DF
Mensajes: 57
Antigüedad: 17 años, 9 meses
Puntos: 4
Enviar Variables con POST usando cURL

Saludos a todos alguien tiene una idea de por que me regresa este mensaje "The Document has moved here" al tratar de enviar algunas variable a un servidor por el metodo POST usando cURL CURLOPT_POST y me he dado cuenta que solo me lo hace con esa url con otras no tengo ningun problema.
La idea principal es hacer un logueo en mi servidor cpanel sin tener que salirme de mi sitio.
Pongo algo de codigo :
Nota. La url que estoy usando es del tipo :$url = 'http://00.000.000.000:Port/login/';
no se si sea por ahi.
Saludos y gracias de antemano.

Código PHP:
<?php
//extract data from the post 
extract($_POST); 
 
//set POST variables 
$url 'http://domain.com/get-post.php'
$fields = array( 
 
'lname'=>urlencode($last_name), 
 
'fname'=>urlencode($first_name), 
 
 
'company'=>urlencode($institution), 
 
'age'=>urlencode($age), 
 
'email'=>urlencode($email), 
 
'phone'=>urlencode($phone
 
); 
 
//url-ify the data for the POST 
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; } 
rtrim($fields_string,'&'); 
 
 
//open connection 
$ch curl_init(); 
 
//set the url, number of POST vars, POST data 
curl_setopt($ch,CURLOPT_URL,$url); 
curl_setopt($ch,CURLOPT_POST,count($fields)); 
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string); 
 
 
//execute post 
$result curl_exec($ch); 
 
 
//close connection 
curl_close($ch);
?>
__________________
Web Hosting y Diseño Web