Connect to twitter.com and copies this webpage to a file.

Dependencies:   EthernetInterface3 HTTPSClient TLS_axTLS mbed-rtos mbed

This example shows how to use the HTTPSClient library by copying the content of this webpage to a file. Before running this program, you must download these certificates and copy them to the mbed. After running this program, a file called index.htm has been created and you can open it with your favorite browser to display the webpage the mbed have just downloaded.

Revision:
3:6d25972a1b21
Parent:
2:e3807a060fa5
--- a/main.cpp	Thu Sep 05 14:29:02 2013 +0000
+++ b/main.cpp	Thu Sep 12 09:06:57 2013 +0000
@@ -7,16 +7,16 @@
     download them from this link:
     http://mbed.org/media/uploads/feb11/certificates-twitter.zip
 */
-
+ 
 #include "mbed.h"
 #include "EthernetInterface.h"
 #include "CertificateManager.h"
 #include "HTTPSClient.h"
-
+ 
 const char host[] = "twitter.com";
 const char request[] = "https://twitter.com";
 LocalFileSystem local("local");
-
+ 
 int main()
 {
     set_time(1378370406);
@@ -28,7 +28,7 @@
         printf("Error with EthernetInterface\n\r");
         return -1;
     }
-
+ 
     /* Loading certificates in precomputed mode */
     CertificateManager::add("/local/cert1.der");
     CertificateManager::add("/local/cert2.der");
@@ -38,7 +38,7 @@
         printf("Failed to load certificates\n");
         return -1;
     }
-
+ 
     /* Now, let's connect to twitter.com */
     HTTPSClient client;
     if(!client.connect(host))    
@@ -91,7 +91,7 @@
         fwrite(buffer, 1, read, fp);
         totalRead += read;
     }
-
+ 
     /* We're done, let's close everything */
     fclose(fp);
     printf("Disconnecting from %s\n", host);
@@ -99,4 +99,4 @@
     eth.disconnect();
     
     return 0;
-}
+}
\ No newline at end of file