Created
October 16, 2013 20:44
Revisions
-
xicalango created this gist
Oct 16, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ #include <stdio.h> #include <stdlib.h> int main(int argc, char** argv) { const char* wget_command = "wget ""%s"" -O ""%s"""; char run_command[1000] = {0}; if( argc != 3 ) { printf("Call %s <url> <outputfile>\n", argv[0]); return EXIT_FAILURE; } int result = snprintf( run_command, 1000, wget_command, argv[1], argv[2] ); if( result < 0 || result > 1000 ) { perror("parameters too long"); } system( run_command ); return EXIT_SUCCESS; } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ #import the module needed import urllib2 import sys #make a request to the server, and place response in a variable response = urllib2.urlopen(sys.argv[1]) #response object is a file like object #read the data from the response into a string html_string = response.read() #write to output with open(sys.argv[2], "w") as f: f.write(html_string)