我无法使用Godaddy主机卷曲地登录Facebook

时间:2019-06-29 17:39:19

标签: php facebook authentication curl

我想使用php的curl自动将评论添加到Facebook。该代码在localhost(xampp)中工作正常,但在godaddy host中工作正常。Curl无法登录Facebook。

我尝试了所有操作,将session更改为falseCURLOPT_SSL_VERIFYPEER false CURLOPT_SSL_VERIFYhost false ...无济于事。

 <?php
     $login_email = '';  
     $login_pass = '';

     $ch = curl_init();  
     curl_setopt($ch, CURLOPT_URL, "https://wwww.facebook.com/login.php");  
     curl_setopt($ch, CURLOPT_POSTFIELDS, 'email=' . urlencode($login_email) . '&pass=' . urlencode($login_pass) .
 '&login=Login');  
     curl_setopt($ch, CURLOPT_POST, 1);  
     curl_setopt($ch, CURLOPT_HEADER, 0);
     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);    
     curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies.txt");  
     curl_setopt($ch, CURLOPT_COOKIEFILE, "cookies.txt");  
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);  
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);  
     curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1;  en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3");
     curl_setopt($ch, CURLOPT_ENCODING, 'UTF-8');
     curl_exec($ch);
     curl_setopt($ch, CURLOPT_URL,"https://mbasic.facebook.com/180562885329138"); $page =
 curl_exec($ch) or die(curl_error($ch));      
     echo htmlspecialchars_decode($page);    ?>

我搜索了很多,我认为这是服务器问题。

实际结果:返回主页而不登录。

0 个答案:

没有答案