Giter Club home page Giter Club logo

Comments (3)

jpbarrette avatar jpbarrette commented on May 21, 2024

examples/example04.cpp has an example on how to get the response code. For doing the download request without getting the body, NoBody is the option for you:

(non-tested code following)

curlpp::Cleanup cleaner;
curlpp::Easy request;

request.setOpt(curlpp::Options::Url("http://yoururl.com"));
request.setOpt(curlpp::Options::NoBody);

request.perform();
std::cout << "Response code: " 
		<< curlpp::infos::ResponseCode::get(request) 
		<< std::endl;

from curlpp.

jpbarrette avatar jpbarrette commented on May 21, 2024

I'm closing this issue, but reopen if you think it doesn't answer your question.

from curlpp.

dima91 avatar dima91 commented on May 21, 2024

in that example i didn't find any refers to NoBody option and if I try to compile this code (from example04.cpp)

curlpp::Cleanup cleaner;
		curlpp::Easy request;

		using namespace curlpp::Options;
		request.setOpt(NoBody);
		request.setOpt(Verbose(true));
		request.setOpt(Url("http://myurl.com"));

		request.perform();

		std::string effURL;
		curlpp::infos::EffectiveUrl::get(request, effURL);
		std::cout << "Effective URL: " << effURL << std::endl;

		//other way to retreive URL
		std::cout << std::endl 
			<< "Effective URL: " 
			<< curlpp::infos::EffectiveUrl::get(request)
			<< std::endl;

		std::cout << "Response code: " 
			<< curlpp::infos::ResponseCode::get(request) 
			<< std::endl;

		std::cout << "SSL engines: " 
			<< curlpp::infos::SslEngines::get(request)
			<< std::endl;

the compilation fails with this error

example04.cpp: In function ‘int main(int, char**)’:
example04.cpp:57:24: error: expected primary-expression before ‘)’ token
   request.setOpt(NoBody);

from curlpp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.