Gafcast Posted March 26, 2009 Share Posted March 26, 2009 Hey all, i recently was gathering images off a website to poll for image frequency. My initial step of the program was to gather the images using a cURL script and then string checking against it. i was able to get that to work fine. however, i was away last week and the website im taking from went from an http to an https. Now my cURL call doesnt return a string i can check against. What can i do to get around the https to get the images into a string again? (btw, i did update the address the cURL was going for to grab the data, im noob, but not that noob ) Thanks! Quote Link to comment Share on other sites More sharing options...
taquitosensei Posted March 26, 2009 Share Posted March 26, 2009 Here's what the manual has to say It sounds like you need to verify that you have SSL support then configure it to use a personal certificate in PEM format if you don't have one in PEM format you need to convert it. HTTPS Secure HTTP requires SSL libraries to be installed and used when curl is built. If that is done, curl is capable of retrieving and posting documents using the HTTPS protocol. Example: curl https://www.secure-site.com Curl is also capable of using your personal certificates to get/post files from sites that require valid certificates. The only drawback is that the certificate needs to be in PEM-format. PEM is a standard and open format to store certificates with, but it is not used by the most commonly used browsers (Netscape and MSIE both use the so called PKCS#12 format). If you want curl to use the certificates you use with your (favourite) browser, you may need to download/compile a converter that can convert your browser's formatted certificates to PEM formatted ones. This kind of converter is included in recent versions of OpenSSL, and for older versions Dr Stephen N. Henson has written a patch for SSLeay that adds this functionality. You can get his patch (that requires an SSLeay installation) from his site at: http://www.drh-consultancy.demon.co.uk/ Example on how to automatically retrieve a document using a certificate with a personal password: curl -E /path/to/cert.pem:password https://secure.site.com/ If you neglect to specify the password on the command line, you will be prompted for the correct password before any data can be received. Many older SSL-servers have problems with SSLv3 or TLS, that newer versions of OpenSSL etc is using, therefore it is sometimes useful to specify what SSL-version curl should use. Use -3, -2 or -1 to specify that exact SSL version to use (for SSLv3, SSLv2 or TLSv1 respectively): curl -2 https://secure.site.com/ Otherwise, curl will first attempt to use v3 and then v2. To use OpenSSL to convert your favourite browser's certificate into a PEM formatted one that curl can use, do something like this (assuming netscape, but IE is likely to work similarly): You start with hitting the 'security' menu button in netscape. Select 'certificates->yours' and then pick a certificate in the list Press the 'export' button enter your PIN code for the certs select a proper place to save it Run the 'openssl' application to convert the certificate. If you cd to the openssl installation, you can do it like: #. /apps/openssl pkcs12 -in [file you saved] -clcerts -out [PEMfile] Quote Link to comment Share on other sites More sharing options...
Gafcast Posted March 26, 2009 Author Share Posted March 26, 2009 ok thanks much. Before i start on the endeavor i just want to double check that i've got a good handle on it. the website im pulling from is: https://realmwar.warhammeronline.com/realmwar/RvROverview.war?server=196&pair=2 which doesnt require a user/password. so as best i can tell.... 1- i'll get OpenSSL, 2- and make sure its "used when curl is built" There's probably a line command for that in the PHP manual i'd imagine. i'll find it. 3- then i can run my cURL as usual and everything should work? Quote Link to comment Share on other sites More sharing options...
taquitosensei Posted March 26, 2009 Share Posted March 26, 2009 you'll probably still need a PEM certificate. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.