Exemple #1
0
/**
 * Create the command POST data
 * 
 * @param sdb the SimpleDB handle
 * @param params the parameter array
 * @return the URL, or NULL on error
 */
char* sdb_post(struct SDB* sdb, struct sdb_params* params)
{
	char* urlencoded;
	if (SDB_FAILED(sdb_params_export(sdb, params, &urlencoded))) return NULL;
	
	return urlencoded;
}
/**
 * Create the command URL
 * 
 * @param sdb the SimpleDB handle
 * @param params the parameter array
 * @return the URL, or NULL on error
 */
char* sdb_url(struct SDB* sdb, struct sdb_params* params)
{
	char* urlencoded;
	if (SDB_FAILED(sdb_params_export(sdb, params, &urlencoded))) return NULL;
	
	char* url = (char*) malloc(strlen(urlencoded) + 64);
	strcpy(url, "http://sdb.amazonaws.com/?");
	strcat(url, urlencoded);
	free(urlencoded);
	
	return url;
}