Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8176765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:19:18+00:00 2026-06-06T23:19:18+00:00

In php there are lines of code like: curl_setopt($ch, CURLINFO_HEADER_OUT, true); I don’t get

  • 0

In php there are lines of code like:

curl_setopt($ch, CURLINFO_HEADER_OUT, true);

I don’t get the exact meaning of it; I assume it is something when set to true means you get the header information along with the response. But it is called against the set methods.

In python’s pycurl library the closest I could get to was pycurl.INFOTYPE_HEADER_OUT. But it throws error when I call it against set methods:

>>> c = pycurl.Curl()
>>> c.setopt(pycurl.INFOTYPE_HEADER_OUT, 1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
pycurl.error: (48, '')
>>> c.getinfo(pycurl.INFOTYPE_HEADER_OUT)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: invalid argument to getinfo

What is the correct python statement I have to type in this case?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T23:19:20+00:00Added an answer on June 6, 2026 at 11:19 pm

    This is not a setting, but rather a flag that is used for debugging purposes to print the raw headers that are sent out by the library. To use it you need to define a callback as your DEBUGFUNCTION and then process the return type:

    sent_headers = []
    received_headers = []
    def collect_headers(debug_type, debug_msg):
        if debug_type == pycurl.INFOTYPE_HEADER_OUT:
                sent_headers.append(debug_msg)
        if debug_type == pycurl.INFOTYPE_HEADER_IN:
                received_headers.append(debug_msg)
    
    # somewhere later in the code
    
    c = pycurl.Curl()
    c.setopt(pycurl.URL, 'http://www.google.com/')
    c.setopt(pycurl.DEBUGFUNCTION, collect_headers)
    c.perform()
    

    Here is the relevant bits from the documentation:

    CURLOPT_DEBUGFUNCTION

    Pass a pointer to a function that matches the following prototype: int
    curl_debug_callback (CURL *, curl_infotype, char *, size_t, void *);
    CURLOPT_DEBUGFUNCTION replaces the standard debug function used when
    CURLOPT_VERBOSE is in effect. This callback receives debug
    information, as specified with the curl_infotype argument. This
    function must return 0. The data pointed to by the char * passed to
    this function WILL NOT be zero terminated, but will be exactly of the
    size as told by the size_t argument.

    Available curl_infotype values:

    CURLINFO_TEXT

    The data is informational text.

    CURLINFO_HEADER_IN

    The data is header (or header-like) data received from the peer.

    CURLINFO_HEADER_OUT

    The data is header (or header-like) data sent to the peer.

    CURLINFO_DATA_IN

    The data is protocol data received from the peer.

    CURLINFO_DATA_OUT

    The data is protocol data sent to the peer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Calling all the PHP helpers out there. So basically I would like to give
Let's say I have some code like this: <html> <head><title>Title</title></head> <body> <?php if (!$someCondition){
I would like to calculate some code metrics for my PHP OOP projects. I
I have some PHP code like the following (simplified): <ul> <?php for ($Index =
I'm trying to write some command line PHP - is there a trick to
Is there a PHP string function that transforms a multi-line string into a single-line
Are there any howtos for using the PHP command line interactively? I found a
In php there is a list of all the parameters you can pass to
I heard that in PHP there are some alternatives for the functions substr() and
I was simply going through the tutorial of PHP there I found that we

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.