Ver Mensaje Individual
  #1 (permalink)  
Antiguo 05/03/2012, 12:44
bikutoru123
 
Fecha de Ingreso: marzo-2012
Mensajes: 4
Antigüedad: 12 años, 2 meses
Puntos: 0
Pregunta problema con librería cURL

// Explicación

Hola a todos bueno me gustaría que desde mi web pudiera interactuar con una web externa. Explicaré de la mejor manera posible mi problema:

Tengo una página web:

www.mi-pagina.com

esta página web es de un juego online

Existe una página web llamada: [URL="http://www.xtremetop100.com"]http://www.xtremetop100.com[/URL]

esta web contiene un rakings de juegos en donde para votar por mi web debes hacer lo siguiente:

1)se debe ir a:
[URL="http://www.xtremetop100.com/in.php?site=1132331256"]http://www.xtremetop100.com/in.php?site=1132331256[/URL]

2)una vez ahí nos pedirá una captcha para poder votar

Si la introducimos correctamente nos redirecciona al index.php de la web y si nos dirigimos a
[URL="http://www.xtremetop100.com/last.php"]http://www.xtremetop100.com/last.php[/URL] y buscamos Mu Caos, debería haberse incrementado el número que está debajo de IN (en otras palabra la votación fue correcta DATO: Se permiten votaciones cada 12 horas por IP)

Detalle. Al utilizar el plugins de firefox llamado live http header, al votar me muestra lo siguiente:

(En donde word = al captcha introducido por el usuario)

// Idea

Bueno mi idea es que me gustaría que a través de un formulario que incluyera el captcha de la web http://www.xtremetop100.com/in.php?site=1132331256
realizara una cabecera http post hacia el servidor externo para votar "automaticamente" (lo pongo entre comillas por que de todas maneras se debe introducir el captcha).

El extracto de código que tengo es el siguiente:

Código PHP:
<?php
include("secure.php");
include(
"config.php");

//Configurar votacion
$votehours "12";
$votecredits "10";
$votelink "http://www.mu-caos.cl";
$url 'www.xtremetop100.com/in.php?site=1132331256';

// Obtiene imagen captcha
$img 'http://www.xtremetop100.com/captchasystem/captcha.php';


$connect mssql_connect($core['db_host'],$core['db_user'],$core['db_password']);
$db mssql_select_db($core['db_name'],$connect);
if(!
$db) die('<center>Conexion SQL fallida!</center>');

function 
vote()
{
global 
$votecredits;
global 
$votelink;
global 
$votehours;

$captcha_valude secure($_POST['captcha_valude']);
$character secure($_POST['character']);
$account secure($_POST['login']);
$data ='site=1132331256&word='.$_POST['captcha_valude'].'&submit=Vote+for+Mu+Caos';
check_inject();

$time 60 60 $votehours;
$timenow time();
$time2 $timenow $time;

$queryaccount mssql_query("Select * from MEMB_INFO where memb___id='$account'");
$accountcheck mssql_num_rows($queryaccount);

$querycharacter mssql_query("Select * from Character where Name='$character'");
$charactercheck mssql_num_rows($querycharacter);

$queryvote mssql_query("Select * from votereward where time>'$time2' and memb___id='$account'");
$votecheck mssql_num_rows($queryvote);

if(empty(
$account)) { echo"<font color='red'>Introduce tu ID!</font><br>"$error=1; }
elseif(empty(
$character)) { echo"<font color='red'>Introduce tu personaje!</font><br>"$error=1; }
elseif(empty(
$captcha_valude)) { echo"<font color='red'>Introduce las letras de la imagen!</font><br>"$error=1; }
elseif(
$accountcheck <= 0) { echo"<font color='red'>La ID ingresada no existe!</font><br>"$error=1; }
elseif(
$charactercheck <= 0) { echo"<font color='red'>El personaje introducido no existe!</font><br>"$error=1; }
elseif(
$votecheck >= 1) { echo"<font color='red'>Votaciones permitidas solo cada $votehours horas!</font><br>"$error=1; }

if(
$error != 1) {
$a mssql_query("INSERT INTO votereward (memb___id, time ) VALUES('$account','$timenow')");
$b mssql_query("Update Character set PCPoints = PCPoints+$votecredits WHERE Name='$character'");

// PRUEBA
$handler curl_init();  
curl_setopt($handlerCURLOPT_URL$url);  
curl_setopt($handlerCURLOPT_POST,true);  
curl_setopt($handlerCURLOPT_POSTFIELDS$data);  
curl_exec ($handler);  
curl_close($handler); 


// PRUEBA
echo"<font color='green'>Votación realizada exitosamente!</font>";
// echo"<meta http-equiv=\"refresh\" content=\"5;url=$votelink\" />";
}
}

if(isset(
$_POST['submit'])) { vote(); }
?>
<br>Por cada voto recibiras <?php echo($votecredits);?> PCPoints!
<table border=0 cellspacing=5 cellpadding=0>
<td width='250'>
<form name="" method="post" action="">
<table width="100%" border="0" cellspacing="1" cellpadding="1">
<tr> 
  <td width="70" height="28" align="center">Login ID:</td>
  <td>&nbsp;</td>
  <td><p>
    <input name="login" type="text" id="login" maxlength="10" />
  </p></td>
</tr>
<tr>
  <td height="20" align="center">Personaje:</td>
  <td>&nbsp;</td>
  <td><input name="character" type="text" id="character" maxlength="10" /></td>
</tr>
<tr> 
<td>
<td align="center">
<td align="left"><div>

<?php echo '<IMG src="'.$img.'">';?>
<p>Inserta las letras de la imagen:</p>
<p><input type="text" id="captcha_valude" name="captcha_valude"></p>
  <input type="submit" class=button name="submit" value="Votar" /> 
  <input type="reset" class=button name="reset" value="Resetear" />
</div>
<td>&nbsp;</td>
</tr>
</table>
</form>
</div>
</td>
</table>
El problema es que no logro enviar la cabecera post o más bien dicho no logro aumentar el IN (no logro votar correctamente de manera externa al servidor)

Si alguien me pudiera indicar que está mal se lo agradecería considerablemente llevo semanas intentando hacer funcionar este código.

Si alguién lograra simplemente mostrarme un código que logre votar de manera externa quedo más que feliz.

Muchas gracias

PD: visualmente los usuarios que votarían en mi web verían el formulario así:

Última edición por bikutoru123; 05/03/2012 a las 12:51