Download http picture using C++


 
Thread Tools Search this Thread
Top Forums Programming Download http picture using C++
# 1  
Old 01-12-2016
Download http picture using C++

Dear all,
I am working on writing the script which can read a file (having the html path for some pictures) and download those picture in the given local directory. Please find my iniatitve here, however I am still not able to figure out the 'download' command.
Any help is appreciated.

thanks,
emily

Code:
#include <iostream>
#include <sstream>
#include <string>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>

using namespace std;

void help() {
  cout << " You must provide one input parameters: " << endl;
  cout << "   1) Name of File containing donlwoad path" << endl;
  exit(0);
}


main(int argc, char *argv[]) {
  if (argc < 2) help();
  string InFile   = argv[1];
  ifstream FileToRead(InFile.c_str());

  // debug step                                                                                                                                                                                                 
  if(!FileToRead.is_open()) {
    cout << "Problem opening the file. Program terminating." << endl;
    exit(EXIT_FAILURE);
  }

  std::string line;
  //  while(!FileToRead.eof()) {                                                                                                                                                                                
  while(std::getline(FileToRead, line))
    {
      FileToRead >> line;
     wget line;                                                                                                                                                                                              
    }
}

# 2  
Old 02-03-2016
Code:
system("wget 'http://url'");

You can feed it a string like system(str.c_str());
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk script to find time difference between HTTP PUT and HTTP DELETE requests in access.log

Hi, I'm trying to write a script to determine the time gap between HTTP PUT and HTTP DELETE requests in the HTTP Servers access log. Normally client will do HTTP PUT to push content e.g. file_1.txt and 21 seconds later it will do HTTP DELETE, but sometimes the time varies causing some issues... (3 Replies)
Discussion started by: Juha
3 Replies

2. Web Development

HTTP Headers Reference: HTTP Status-Codes

Hypertext Transfer Protocol -- HTTP/1.1 for Reference - HTTP Headers 10 Status Code Definitions Each Status-Code is described below, including a description of which method(s) it can follow and any metainformation required in the response. (1 Reply)
Discussion started by: Neo
1 Replies

3. Shell Programming and Scripting

File download from HTTP::DAV

Hi, I have DOX server. I have to download latest file using HTTP:: DAV. at present am using get method with file name ABC*, it downloads all the files. But I need to download only latest file. Any help?? Thanks, Raja. (0 Replies)
Discussion started by: smr_rashmy
0 Replies

4. Shell Programming and Scripting

sending http url through http socket programming..

hi am senthil am developing a software to send and receive SMS using HTTP connection first of all am forming a URL and sending that URL to a remote server using my Client Program i send that url through Socket(using Send() Function) if i send more than one URL one by one using the same... (4 Replies)
Discussion started by: senkerth
4 Replies

5. Programming

sending http url through http socket programming..

hi am senthil am developing a software to send and receive SMS using HTTP connection first of all am forming a URL and sending that URL to a remote server using my Client Program i send that url through Socket(using Send() Function) if i send more than one URL one by one using the same... (0 Replies)
Discussion started by: senkerth
0 Replies

6. Shell Programming and Scripting

How to download X bytes from a file using ftp or http?

Hi, I have a simple ftp shell script which can download the entire file, however I want to know if there is anyway that I can download only the partial content, say X bytes from a file. If so, how I can do it using ftp and http.. Here is my sample script #!/bin/sh HOST='xyz.com' ... (5 Replies)
Discussion started by: learn more
5 Replies

7. UNIX for Advanced & Expert Users

Coomand to download from HTTP(URL)

Hi, What is the UNIX command to download a file or data from HTTP location. CURL(Linux) did not work. Thank You (4 Replies)
Discussion started by: skm123
4 Replies

8. Post Here to Contact Site Administrators and Moderators

picture

How i do i post a picture below my name as some of u have???? Is there a rule like only those who are moderators, administrators only can have a picture below their names??? If not, then kindly tell me how to post a picture below my name?? Thanks, Nisha :rolleyes: (44 Replies)
Discussion started by: Nisha
44 Replies

9. UNIX for Dummies Questions & Answers

GCC via Http-Download?

Hello all, i am looking for a long time now after GCC. I cannot download it via FTP, thatīs the problem. Is somebody here who knows where i can get it over HTTP?? Regards and Thank You, Chris (5 Replies)
Discussion started by: cyberbloodgoat
5 Replies
Login or Register to Ask a Question