Ciao a tutti, sto cercando di far funzionare il servizio di sms di xyz in automatico. Loro infatto danno a disposizione un paio di script che però necessitano di 2 o 3 click per confermare l'invio.
Invece io vorrei far funzionare tutto in background senza tante conferme lato client.
Putroppo non ci riesco. Copiando qua e la dagli script che fornisce xyz, mi pare di aver capito che dopo salti qua e la fra varie pagine, la cosa importante è l'ultimo form all'ultima pagina:
Codice PHP:
<?php
if(eregi("Riepilogo.php",$PHP_SELF)) {
die();
}
$params = array("smstipodest", "PrefissoMessaggio", "NumeroMessaggio",
"MittenteMessaggio", "TestoMessaggio", "UrlCliente",
"tptarget", "smsflash", "smspubblicit");
foreach($params as $pname) {
if(isset($HTTP_COOKIE_VARS["$pname"])){
$$pname = htmlentities(stripslashes($HTTP_COOKIE_VARS["$pname"]));
} else {
$$pname = "";
}
}
?>
<html>
<head>
<title><?php if(isset($Titolo)) { echo $Titolo; } ?></title>
<style type="text/css"><!--
.bianco10sx { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; text-decoration: none; text-align: left; color: #FFFFFF}
.rex { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; text-decoration: none; color: #B92203; text-align: justify}
.lau { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; text-decoration: none; color: #000000; text-align: justify}
--></style>
<Script Language="JavaScript" src="FileMain.js"></Script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" OnUnload="DeleteFile()">
<Script Language="JavaScript">
var now = new Date()
var CancFile = ""
function DeleteFile()
{
if (CancFile == "")
{
delCookie("TestoMessaggio")
delCookie("NumeroMessaggio")
delCookie("PrefissoMessaggio")
delCookie("MittenteMessaggio")
delCookie("smstipodest")
delCookie("tptarget")
delCookie("UrlCliente")
delCookie("<?php echo $RandID; ?>")
window.open("ProxyPage.php?TipoOperazione=CANCFILE&RandID=<?php echo $RandID; ?>","finestra","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=20,height=20,top=200,left=450")
}
}
function AbilitaDeleteFile()
{
CancFile = "KO"
PathReferer = document.location.host + document.location.pathname
document.FormAttivo.PathReferer.value = PathReferer
}
</Script>
<form method="POST" action="http://xyz/Secure_inviasmsdomini.asp"
Name="FormAttivo" Method="POST" OnSubmit="AbilitaDeleteFile()">
<table border="0" cellPadding="0" cellSpacing="0" align="center" width="335" height="240">
<tr>
<td align="center" valign="middle" height="10">
<table border="0" cellPadding="0" cellSpacing="5" align="center" width="315"
class="lau" bgcolor="#FFFFFF">
<tr>
<td align="center" height="15" valign="middle">
<font class="rex">[b]L'SMS verrà inviato con i seguenti dati:[/b]<font></td>
</tr>
<tr>
<td align="center" height="25">
<table class="lau" border="0">
<tr>
<td>[b]Numero: [/b]</td>
<td>[b]+<font class="rex"><?php
echo $PrefissoMessaggio . $NumeroMessaggio; ?></font>[/b]</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align=center height="10">
<table class="lau" border="0">
<td>[b]Mittente:[/b]</td>
<td><font class="rex">[b]<?php
echo $MittenteMessaggio ?>[/b]</font>[/b]</td>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="bottom" align="center" height="20" >
[b]<font class="lau">Testo del messaggio:</font>[/b]</td>
</tr>
<tr>
<td valign="top" align="center" height="65" ><textarea cols="6" rows="3" style="WIDTH: 290px" type="text" name="smstesto" onkeyup="javascript:messcontacar();" onchange="javascript:messcontacar();" style="" contenteditable=false><?php
echo $TestoMessaggio ?></textarea>
</td>
</tr>
<tr>
<input type="hidden" name="RandID" value="<?php echo $RandID; ?>">
<input type="hidden" name="RiepilogoFatto" value="SI">
<input type="hidden" name="UrlCliente" value="<?php
echo "http://" . $UrlCliente; ?>">
<input type="hidden" name="IDCodSMS" value="<?php echo $IDCodSMS; ?>">
<input type="hidden" name="smstipodest" value="<?php
echo $smstipodest; ?>">
<input type="hidden" name="tptarget" value="<?php
echo $tptarget; ?>">
<input type="hidden" name="smsmittente" value="<?php
echo $MittenteMessaggio; ?>">
<input type="hidden" name="smsprefcell" value="<?php
echo $PrefissoMessaggio; ?>">
<input type="hidden" name="smsdestinatario" value="<?php
echo $NumeroMessaggio; ?>">
<input type="hidden" name="smsflash" value="<?php
echo $smsflash; ?>">
<input type="hidden" name="smspubblicit" value="<?php
echo $smspubblicit; ?>">
<input type="hidden" name="PathReferer" value="">
<td align="center"><input type="Image" src="prosegui.gif" Style="cursor:hand"></td>
</tr>
</table>
</form>
</body>
</html>
da ciò ho prodotto questo:
Codice PHP:
[.........] function AbilitaDeleteFile()
{
CancFile = "KO"
PathReferer = document.location.host + document.location.pathname
document.FormAttivo.PathReferer.value = PathReferer
}
</Script>
[.....]
$destinatario=substr($row[0], 3);
$prefisso=substr($row[0], 0, 3);
$RandID = MakeRandID();
echo("<form action='http://xyz/Secure_inviasmsdomini.asp' Name='FormAttivo' Method='POST' OnSubmit='AbilitaDeleteFile()'>
<input type='hidden' name='RandID' value='$RandID'>
<input type='hidden' name='RiepilogoFatto' value='SI'>
<input type='hidden' name='UrlCliente' value='http://www.cervezafest.com/reserved_test/reserved.php'>
<input type='hidden' name='IDCodSMS' value='******'>
<input type='hidden' name='smstipodest' value=''>
<input type='hidden' name='tptarget' value=''>
<input type='hidden' name='smsmittente' value='pippo'>
<input type='hidden' name='smsprefcell' value='$prefisso'>
<input type='hidden' name='smsdestinatario' value='$destinatario'>
<input type='hidden' name='smsflash' value=''>
<input type='hidden' name='smspubblicit' value=''>
<input type='hidden' name='PathReferer' value=''>
<input type='hidden' name='smstesto' value='$txt'>
</form>"); [..........]
La funzione Make Rand Id è quella fornita da xyz...
Qualche suggerimento?
Saluti