Skip to content

Instantly share code, notes, and snippets.

@ssaavedra
Created April 23, 2013 15:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ssaavedra/5444397 to your computer and use it in GitHub Desktop.
Save ssaavedra/5444397 to your computer and use it in GitHub Desktop.
/***************************************************************************
* Twitter client for the CLI. *
* Copyright (C) 2013 by Santiago Saavedra and Daniel Valcarce *
* <santiagosaavedra@gmail.com>, <danivalsil@gmail.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
/***************************************************************************
* This is made as a final exercise for Compilers in the University of *
* A Coruna. *
* Year: 2012/2013 *
**************************************************************************/
#include "headers.h"
#include "json_utils.h"
char *server;
char *url;
extern char *http_server;
extern int http_port;
extern char *http_proxy_server;
extern int http_proxy_port;
int main(int argc, char *argv[])
{
http_port = 80;
int retcode;
char *data;
char type[64];
int len;
if (argc < 2) {
fprintf(stderr, "Feed me a file.\n");
exit(EXIT_FAILURE);
}
http_server = argv[1];
url = argv[2];
retcode = http_get(url, &data, &len, type);
printf("Received retcode = %d\n", retcode);
printf("Len = %d || Type = %s\n", len, type);
printf("\n----- BEGIN DATA BLOCK -----\n");
printf("%s", data);
printf("\n----- END DATA BLOCK -----\n");
return 0;
}
@dvalcarce
Copy link

Daniel@MacBook-Pro-3:twitter-cli $ ./twitter-cli http://www.google.es
host=(www.google.es), port=80, filename=()
HTTP/1.0 302 Found
http_retcode = 302, typebuf = '', length = 0
data: (null)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment