Having Difficulty Using cURL and PHP to Login and Download
Here is the code that I am using to try and accomplish this:
<?php
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, 'linkToLoginPage.php');
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, 'email=email@example.com,password=password');
curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$store = curl_exec ($ch);
curl_setopt($ch, CURLOPT_URL, 'link开发者_JAVA技巧ToDownloadFile.pdf');
$content = curl_exec ($ch);
curl_close ($ch); 
?>
I set it up with my information, but it just produces a blank page.  I think my main issue is with the CURLOPT_POSTFIELDS.  Here is the link to the page I am trying to login.
I looked at the source code but I cannot find a clear definition of the form values. Any ideas?
Try
curl_setopt($ch, 
            CURLOPT_POSTFIELDS, 
            'email=email@example.com&password=password' );
(& not ,)
 
         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论