document.form1.action='../index.php'; document.form1.submit()şeklinde..
Soruma gelirsek bu formu nasıl post edebiliriz curl ile? Submit olsaydı name=value Şeklinde post ediyorduk ama şuan ne yapacağımı bilemedim aşmanın bi yolu var mı? Teşekkürler.
12
●7.114
document.form1.action='../index.php'; document.form1.submit()şeklinde..
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "site.com");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_REFERER, "http://google.com");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "kullanici=By_system&sifre=123456");
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
$data = curl_exec($ch);
curl_close($ch);
echo $data;
?>post fields kısmında post edebileceğim bi submit tagı yok sorun burada.. teşekkürler..
<html>
<head>
/*Jquery tanımlamalarını yaptığını varsayiyorum*/
<script type="text/javascript">
var serial = $("#kullaniciform").serialize(); //formdaki butun verileri alir
$.ajax({
type:"POST",
url:"curlpost.php",
data:serial,
success:function(gelen){
alert(gelen);
}
});
</script>
</head>
<body>
<form id="kullaniciform" method="post" action="javascript:;">
<input type="text" name="kullanici" />
<input type="text" name="sifre" />
<input type="button" value="git ve al" onclick="gitalgel()" />
</form>
</body>
</html>curlpost.php için
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "site.com");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_REFERER, "http://google.com");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "kullanici=".$_POST[kullanici]."&sifre=".$_POS[sifre]);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
$data = curl_exec($ch);
curl_close($ch);
echo $data;
?>ama eğer istedigin formdaki verileri js ile gondermek ise böylede yapabilirsin.
<Form Name="form1" method="POST"> <b>Kullanıcı Adı</b> <input type="text" name="kullanici" size="20" MaxLength="20" taborder="0"> <b>Şifre</b> <input type="password" name="sifre" size="20" MaxLength="20" taborder="1"> <a href="javascript: Giris();"> <img border="0" src="login.gif" style="cursor:hand"></a> </form>
function Giris() {
document.form1.action='www.site.com/login.php';
document.form1.submit()
}form ve javascript fonksiyonu böyle
Bi deneyeyim o zaman bakalım neymiş istediği..