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 6819247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:16:59+00:00 2026-05-26T21:16:59+00:00

First I initialize curl handle: $ch = curl_init(); Next I set the url and

  • 0

First I initialize curl handle:

$ch = curl_init();

Next I set the url and referer headers:

curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_REFERER,$referer);

And finally execute statement:

curl_exec($ch);

Now I can use another url without closing and reopening the handle, so:

curl_setopt($ch,CURLOPT_URL,$another_url);

And here headache begins, because I do not know how to disable referer header that would be send do server, of course I’ve tried to put false and null into CURLOPT_REFERER but it causes the referer field to be empty, that is a Referer: is still send to the server but with no value (is this even correct with http specs?).

Is there any option to remove header altogether without closing and reinstantiating curl handle ?

I’d like to avoid it because curl keeps a connection open for some time, if I would constantly close the handle while downloading from the same host it could take more time.

  • 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-05-26T21:17:00+00:00Added an answer on May 26, 2026 at 9:17 pm

    You can remove completely the referer field, or any other field normally handled by curl, by passing it without anything after “:” to CURLOPT_HTTPHEADER:

    curl_setopt($ch, CURLOPT_HTTPHEADER, array("Referer:"));
    

    And it won’t appear at all in the header.

    http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTHTTPHEADER

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

Sidebar

Related Questions

I create a linked list dynamically and initialize the first node in main(), and
First, in my root view controllers viewDidLoad, I initialize an NSDictionary with arrays of
Is there a way to declare first and then initialize an array in C?
How to initialize the structure in another class? there is struct in first class:
In a Flex DataGrid's first row, the itemRenderer will initialize twice. Tracing the results
So I used the code here to first initialize the OpenGL in my Live
i am using NSArray named as allAvailableServices . first i initialize it and after
The First One module A include B def initialize ----- end def x ---------
I'm using jCanvas to paint on a HTML canvas element. First I initialize a
is there a way of first initialize shared_ptr with nullptr and after some time

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.