2016-04-14 9 views
0

ile başka bir siteye giriş yapamıyorum, ama çalışmıyor! ve çıkış sonucu sadece Giriş sayfası ... kullanıcı adı ve şifre görebilirsiniz, site yapısını kontrol etmek için çekinmeyin - 6 diğer CURL giriş örneklerini deniyordum ama hepsi başarısız. bu benim son şansım, benim kodudur:, "<a href="http://fourse.com/automation/Page/Login" rel="nofollow">http://fourse.com/automation/Page/Login</a>" sayfasına giriş yapmayı denemek ve 'yeni destek' sayfasını getirmeye çalışmak için php CURL

 /* Login part of the code -- start */ 

     $cookie_file_path = getcwd() . '/cookie.txt'; 
     //Emulating Firefox Browser: 
     $agent = $_SERVER['HTTP_USER_AGENT']; 
     //First, get and write session cookie: 
     $ch = curl_init(); 

     curl_setopt($ch, CURLOPT_URL,'http://fourse.com/automation/Page/Login'); 
     curl_setopt($ch, CURLOPT_USERAGENT, $agent); 
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); 
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 
     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); 
     curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path); 
     curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path); 

     $loginpage_html = curl_exec ($ch); 

     curl_close ($ch); 

     //Now, use the session cookie to actually log in: 
     $POSTFIELDS = "username=esmaeili&password=183791"; 

     $ch = curl_init(); 


     curl_setopt($ch, CURLOPT_URL,'http://fourse.com/automation/support/new-support'); 
     curl_setopt($ch, CURLOPT_USERAGENT, $agent); 
     curl_setopt($ch, CURLOPT_POST, 1); 
     curl_setopt($ch, CURLOPT_POSTFIELDS,$POSTFIELDS); 
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); 
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 
     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); 
     curl_setopt($ch, CURLOPT_REFERER, 'http://fourse.com/automation/support/new-support'); 
     curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path); 
     curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path); 

     $logon_result = curl_exec ($ch); 
     curl_close ($ch); 


     echo $logon_result; 
+0

"Çalışmıyor" ne anlama geliyor? – miken32

+0

Ayrıca, neden kıvırma tutamacını kapatıp yeniden başlatıyorsunuz? Sadece çerez dosyasını boş dizgiye ayarlayın, çerez kavanozunu ayarlamayın, tanıtıcıyı tekrar kullanmayın ve çerezleri kaydedeceksiniz. – miken32

+0

iyi CURL için yeni, bu komut dosyasını çalıştırdıktan sonra benim için giriş sayfası yankılandıracak! ana sayfa yerine – User9123

cevap

-1

"login" Eğer göndermiyorsanız denilen formun bir gizli alan yoktur.

+0

Vay teşekkürler! Sorun gizli girdi, şimdi iyi çalışıyor – User9123

+0

@ User9123 Yardım edebileceğime sevindim. – Chris

İlgili konular