Fihrist

post etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster
post etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster

27 Şubat 2011 Pazar

pHp'de Otomatik Form Gonderimi

Gonderilecek inputlar bir dizi icine konur.
$post_data['input1'] = $input1;
$post_data['input2'] = $input2;
...
Dizi gonderilmeye hazirlanir.
foreach ($post_data as $key => $value) {
 $post_items[] = $key . '=' . $value;
}
Son string ayarlanir.
$post_string = implode ('&', $post_items);
Gonderilecek link belirlenir.
$curl_connection = curl_init('http://gonder.ilecek/adres');
Basliklar ayarlanir.
curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($curl_connection, CURLOPT_USERAGENT,
 "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 1);
Post edilecek data ayarlanir.
curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $post_string);
Istek gonderilir.
$result = curl_exec($curl_connection);
Baglanti kapatilir.
curl_close($curl_connection);