par
ruslan59 » 21 avr. 2009, 08:14
Oui je vais mettre ça.
Alors j'ai 2 pages du mon site
1ere page (gatewayconnect.php)
Code : Tout sélectionner
define('LOGIN', 'ruslan59');
define('PASSWORD', 'monpasswd');
define('AUTHENTIFICATION', 'http://www.site_distant.com/index.php');
define('PAGE_PRIVEE', 'http://www.site_distant.com/index.php?page=formulaire');
$sid = '';
/**
* Première connexion : authentification
**/
$ch = curl_init(AUTHENTIFICATION);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS,
array(
'login' => LOGIN,
'mdp' => PASSWORD
)
);
curl_setopt($ch, CURLOPT_COOKIEJAR, realpath('cookie.txt'));
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_COOKIESESSION, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$ret = curl_exec($ch);
if ($ret === FALSE) {
die(curl_error());
}
curl_close($ch);
if (preg_match('/(PHPSESSID=[0-9a-z,-]{32,40})/i', $ret, $m)) {
$sid = '?' . $m[1];
} else if (preg_match('#<input\s+type="hidden"\s+name="([^\r\n\t <>\'"\\\]+)"\s+value="([0-9a-z,-]{32,40})"\s*/?>#i', $ret, $m)) {
$sid = '?' . $m[1] . '=' . $m[2];
}
Ensuite mon formulaire (form.php)
Code : Tout sélectionner
<?php include ("gatewayconnect.php"); ?>
...
<form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>" name="form">
<table border="0" width="72%" cellspacing="1">
<tr>
<td height="55"> </td>
</tr>
<tr>
<td height="5"> </td>
</tr>
<tr>
<td>
<input type="text" id="num" maxlength="10" name="destinataire" onBlur="vNum()" onchange="ScanForEmpty()" size="18" value="N° du destinataire" OnFocus="this.value=''" style="border: 1px dotted #800080"></td>
</tr>
<tr>
<td>Message</td>
</tr>
<tr>
<td height="50">
<textarea rows="3" maxlength="149" id="portugal-tchat.com" onkeyup="ScanForEmpty()" name="message" cols="14" style="border: 1px dotted #800080"></textarea></td>
</tr>
<tr><td align="center">
<script>displaylimit("","portugal-tchat.com",149)</script>
</td></tr>
<tr>
<td>
<p align="center">
<input type="hidden" name="prenom" value="<?php echo $prenom; ?>">
<input type="hidden" name="login" value="<?php echo $login; ?>">
<input type="submit" disabled="true" onclick="vNum();" value="Envoyer" name="send" style="float: center"></td>
</tr>
</table>
</form>
...
Et c'est là que je bloque =(
Je veux que lorsque que j'envoi le formulaire de mon site
bah c'est en même temps envoyer le formulaire du site distant
[/code]
Oui je vais mettre ça.
Alors j'ai 2 pages du mon site
1ere page (gatewayconnect.php)
[code]
define('LOGIN', 'ruslan59');
define('PASSWORD', 'monpasswd');
define('AUTHENTIFICATION', 'http://www.site_distant.com/index.php');
define('PAGE_PRIVEE', 'http://www.site_distant.com/index.php?page=formulaire');
$sid = '';
/**
* Première connexion : authentification
**/
$ch = curl_init(AUTHENTIFICATION);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS,
array(
'login' => LOGIN,
'mdp' => PASSWORD
)
);
curl_setopt($ch, CURLOPT_COOKIEJAR, realpath('cookie.txt'));
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_COOKIESESSION, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$ret = curl_exec($ch);
if ($ret === FALSE) {
die(curl_error());
}
curl_close($ch);
if (preg_match('/(PHPSESSID=[0-9a-z,-]{32,40})/i', $ret, $m)) {
$sid = '?' . $m[1];
} else if (preg_match('#<input\s+type="hidden"\s+name="([^\r\n\t <>\'"\\\]+)"\s+value="([0-9a-z,-]{32,40})"\s*/?>#i', $ret, $m)) {
$sid = '?' . $m[1] . '=' . $m[2];
}
[/code]
Ensuite mon formulaire (form.php)
[code]
<?php include ("gatewayconnect.php"); ?>
...
<form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>" name="form">
<table border="0" width="72%" cellspacing="1">
<tr>
<td height="55"> </td>
</tr>
<tr>
<td height="5"> </td>
</tr>
<tr>
<td>
<input type="text" id="num" maxlength="10" name="destinataire" onBlur="vNum()" onchange="ScanForEmpty()" size="18" value="N° du destinataire" OnFocus="this.value=''" style="border: 1px dotted #800080"></td>
</tr>
<tr>
<td>Message</td>
</tr>
<tr>
<td height="50">
<textarea rows="3" maxlength="149" id="portugal-tchat.com" onkeyup="ScanForEmpty()" name="message" cols="14" style="border: 1px dotted #800080"></textarea></td>
</tr>
<tr><td align="center">
<script>displaylimit("","portugal-tchat.com",149)</script>
</td></tr>
<tr>
<td>
<p align="center">
<input type="hidden" name="prenom" value="<?php echo $prenom; ?>">
<input type="hidden" name="login" value="<?php echo $login; ?>">
<input type="submit" disabled="true" onclick="vNum();" value="Envoyer" name="send" style="float: center"></td>
</tr>
</table>
</form>
...
[/code]
Et c'est là que je bloque =(
Je veux que lorsque que j'envoi le formulaire de mon site
bah c'est en même temps envoyer le formulaire du site distant
[/code]