Download PDF from ieeexplore.ieee.org via PHP
===

I was trying to download a pdf file from ieeexplore via PHP, but it seems not working well. Suppose the URL is http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=5534992. I wrote the following PHP code:

    function get_web_page($url) {
        $ch  = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_COOKIESESSION, true);
        curl_setopt($ch, CURLOPT_COOKIEJAR, '/tmp/cookie.txt');
        curl_setopt($ch, CURLOPT_COOKIEFILE, '/tmp/cookie.txt');
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_HEADER, 0);        
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        $page = curl_exec($ch);
        curl_close($ch);
        return $page;
    }

But this code failed with nothing downloaded. I checked the received http header in the following:

    HTTP/1.0 200 Connection established HTTP/1.1 302 Moved Temporarily Server: Sun-ONE-Web-    Server/6.1 Date: Mon, 09 Jul 2012 22:11:50 GMT Content-length: 0 Content-type: text/html Set-Cookie: ERIGHTS=na2vLnqZwz9xxRfO2zN8Ny66f0vHi85YE*ynGx2BtGx2FmIHkiEyx2Bg89Db6Qx3Dx3D-18x2dHeJj2k3B7UHsoix2BefrHXeAx3Dx3Dusln2oQUqj3KXiQXjOYx2BMwx3Dx3D-UQmTydx2FMwnGJOyKUw5iVDAx3Dx3D-eV0zE6ztXYKrVZluJrMMbAx3Dx3D;path=/;domain=.ieee.org Location: http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=5534992&tag=1 Set-Cookie: WLSESSION=874668684.20480.0000; expires=Tue, 10-Jul-2012 22:11:48 GMT; path=/ HTTP/1.1 200 OK Server: Sun-ONE-Web-Server/6.1 Date: Mon, 09 Jul 2012 22:11:50 GMT Content-length: 203 Content-type: text/html; charset=UTF-8 Cache-Control: private Product: 254 Inst: 9690 Licenseowner: 9690 Member: 0 Cache-Control: no-cache Pragma: No-cache Expires: Thu, 01 Jan 1970 00:00:00 GMT Set-Cookie: xploreCookies={"standardsLicenseId":"0","openUrl":"http://linkserv.lib.utk.edu:9003/sfx","enterpriseLicenseId":"0","isIp":"true","desktopReportingUrl":"null","openUrlImgLoc":"http://www.lib.utk.edu/eresources/sfx2.gif","products":"IEL|VDE|","contactName":"NA","isChargebackUser":"false","contactEmail":"NA","oldSessionKey":"na2vLnqZwz9xxRfO2zN8Ny66f0vHi85YE*ynGx2BtGx2FmIHkiEyx2Bg89Db6Qx3Dx3D-18x2dHeJj2k3B7UHsoix2BefrHXeAx3Dx3Dusln2oQUqj3KXiQXjOYx2BMwx3Dx3D-UQmTydx2FMwnGJOyKUw5iVDAx3Dx3D-eV0zE6ztXYKrVZluJrMMbAx3Dx3D","userIds":"9690","instImage":"","isInst":"true","isDelegatedAdmin":"false","isMember":"false","instName":"UNIVERSITY OF TENNESSEE","customerSurvey":"NA","smallBusinessLicenseId":"0","openUrlTxt":"NA"}; domain=.ieee.org; path=/ Set-Cookie: JSESSIONID=V6pLP7XH4nvtQYcvmVc1ry1Y51vDHhkG8SGn9y0LG8XJv3k3hmJs!-1711984930; path=/; HttpOnly X-Powered-By: Servlet/2.5 JSP/2.1 An error has occurred while trying to load your document. Please try again. If you continue to experience issues, please contact Customer Service.2016

However, if you paste the URL in the web browser, you may access the PDF file directly.

Since I was in my University's domain, I did not need to worry about the access license to this PDF file.

Anyone has ideas?

Thanks~