cURL / Mailing Lists / curl-library / Single Mail


help with novice program

From: neil sutton <>
Date: Tue, 10 Aug 2010 19:33:23 +0100

Hi, I am trying to write a simple program in C++ that obtains user input of a string.
The curl library is then used to make a connection to a given website and then - if possible search for all occurance of the given string. My questions are:

1. Is it essential to transfer a copy of the online resource before searching for the expression? Could my program search the online resource remotely?

2. This is the simple code i have written so far:
#include <string>
#include <iostream>
#include <curl/curl.h>

using namespace std;

// simple program to obtain user input of a string, connect to a website to search for occurances of
// the string

int main()
    int end(1);
    while (end != 0)
        // Initialisation of curl
    std::string myword;

    cout << "Input a word to search for \n";
    cin >> myword;
    cout << "Searching for occurances of " << myword << endl;
    // insert connection and search code here
    // which website?
    // look for myword

    cout << "Do you wish to search again? ENTER 0 to end or 1 to search again\n";
    cin >> end;
    if (end == 0)
    return 0;



Now suppose I wish to search the URL for all occurances of the string myword, how would I actually code this? Im not even sure that the code i have written properly invokes curl, though it does compile. Any suggestions would be welcome. Once i get this program working, i will feel more confident in experimenting further.

Many thanks

List admin:
Received on 2010-08-10