stackoverflow.com Open in urlscan Pro
151.101.65.69  Public Scan

URL: https://stackoverflow.com/questions/9445489/performing-http-requests-with-curl-using-proxy
Submission: On November 29 via manual from AU — Scanned from AU

Form analysis 2 forms found in the DOM

/search

<form id="search" role="search" action="/search" class="s-topbar--searchbar js-searchbar " autocomplete="off">
  <div class="s-topbar--searchbar--input-group">
    <input name="q" type="text" role="combobox" placeholder="Search…" value="" autocomplete="off" maxlength="240" class="s-input s-input__search js-search-field " aria-label="Search" aria-controls="top-search" data-controller="s-popover"
      data-action="focus->s-popover#show" data-s-popover-placement="bottom-start" aria-expanded="false">
    <svg aria-hidden="true" class="s-input-icon s-input-icon__search svg-icon iconSearch" width="18" height="18" viewBox="0 0 18 18">
      <path d="m18 16.5-5.14-5.18h-.35a7 7 0 1 0-1.19 1.19v.35L16.5 18l1.5-1.5ZM12 7A5 5 0 1 1 2 7a5 5 0 0 1 10 0Z"></path>
    </svg>
    <div class="s-popover p0 wmx100 wmn4 sm:wmn-initial js-top-search-popover" id="top-search" role="menu">
      <div class="s-popover--arrow"></div>
      <div class="js-spinner p24 d-flex ai-center jc-center d-none">
        <div class="s-spinner s-spinner__sm fc-orange-400">
          <div class="v-visible-sr">Loading…</div>
        </div>
      </div>
      <span class="v-visible-sr js-screen-reader-info"></span>
      <div class="js-ac-results overflow-y-auto hmx3 d-none"></div>
      <div class="js-search-hints" aria-describedby="Tips for searching"></div>
    </div>
  </div>
</form>

POST /questions/9445489/answer/submit

<form id="post-form" action="/questions/9445489/answer/submit" method="post" class="js-add-answer-component post-form">
  <input type="hidden" id="post-id" value="9445489">
  <input type="hidden" id="qualityBanWarningShown" name="qualityBanWarningShown" value="false">
  <input type="hidden" name="referrer" value="">
  <h2 class="space" id="your-answer-header"> Your Answer </h2>
  <script>
    StackExchange.ifUsing("editor", function() {
      StackExchange.using("externalEditor", function() {
        StackExchange.using("snippets", function() {
          StackExchange.snippets.init();
        });
      });
    }, "code-snippets");
  </script>
  <script>
    StackExchange.ready(function() {
      var channelOptions = {
        tags: "".split(" "),
        id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);
      StackExchange.using("externalEditor", function() {
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
            createEditor();
          });
        } else {
          createEditor();
        }
      });

      function createEditor() {
        StackExchange.prepareEditor({
          useStacksEditor: false,
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
            brandingHtml: "Powered by \u003ca href=\"https://imgur.com/\"\u003e\u003csvg class=\"svg-icon\" width=\"50\" height=\"18\" viewBox=\"0 0 50 18\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"\u003e\u003ctitle\u003eImgur Logo\u003c/title\u003e\u003cpath d=\"M46.1709 9.17788C46.1709 8.26454 46.2665 7.94324 47.1084 7.58816C47.4091 7.46349 47.7169 7.36433 48.0099 7.26993C48.9099 6.97997 49.672 6.73443 49.672 5.93063C49.672 5.22043 48.9832 4.61182 48.1414 4.61182C47.4335 4.61182 46.7256 4.91628 46.0943 5.50789C45.7307 4.9328 45.2525 4.66231 44.6595 4.66231C43.6264 4.66231 43.1481 5.28821 43.1481 6.59048V11.9512C43.1481 13.2535 43.6264 13.8962 44.6595 13.8962C45.6924 13.8962 46.1709 13.2535 46.1709 11.9512V9.17788Z\"/\u003e\u003cpath d=\"M32.492 10.1419C32.492 12.6954 34.1182 14.0484 37.0451 14.0484C39.9723 14.0484 41.5985 12.6954 41.5985 10.1419V6.59049C41.5985 5.28821 41.1394 4.66232 40.1061 4.66232C39.0732 4.66232 38.5948 5.28821 38.5948 6.59049V9.60062C38.5948 10.8521 38.2696 11.5455 37.0451 11.5455C35.8209 11.5455 35.4954 10.8521 35.4954 9.60062V6.59049C35.4954 5.28821 35.0173 4.66232 34.0034 4.66232C32.9703 4.66232 32.492 5.28821 32.492 6.59049V10.1419Z\" /\u003e\u003cpath fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M25.6622 17.6335C27.8049 17.6335 29.3739 16.9402 30.2537 15.6379C30.8468 14.7755 30.9615 13.5579 30.9615 11.9512V6.59049C30.9615 5.28821 30.4833 4.66231 29.4502 4.66231C28.9913 4.66231 28.4555 4.94978 28.1109 5.50789C27.499 4.86533 26.7335 4.56087 25.7005 4.56087C23.1369 4.56087 21.0134 6.57349 21.0134 9.27932C21.0134 11.9852 23.003 13.913 25.3754 13.913C26.5612 13.913 27.4607 13.4902 28.1109 12.6616C28.1109 12.7229 28.1161 12.7799 28.121 12.8346C28.1256 12.8854 28.1301 12.9342 28.1301 12.983C28.1301 14.4373 27.2502 15.2321 25.777 15.2321C24.8349 15.2321 24.1352 14.9821 23.5661 14.7787C23.176 14.6393 22.8472 14.5218 22.5437 14.5218C21.7977 14.5218 21.2429 15.0123 21.2429 15.6887C21.2429 16.7375 22.9072 17.6335 25.6622 17.6335ZM24.1317 9.27932C24.1317 7.94324 24.9928 7.09766 26.1024 7.09766C27.2119 7.09766 28.0918 7.94324 28.0918 9.27932C28.0918 10.6321 27.2311 11.5116 26.1024 11.5116C24.9737 11.5116 24.1317 10.6491 24.1317 9.27932Z\"/\u003e\u003cpath d=\"M16.8045 11.9512C16.8045 13.2535 17.2637 13.8962 18.2965 13.8962C19.3298 13.8962 19.8079 13.2535 19.8079 11.9512V8.12928C19.8079 5.82936 18.4879 4.62866 16.4027 4.62866C15.1594 4.62866 14.279 4.98375 13.3609 5.88013C12.653 5.05154 11.6581 4.62866 10.3573 4.62866C9.34336 4.62866 8.57809 4.89931 7.9466 5.5079C7.58314 4.9328 7.10506 4.66232 6.51203 4.66232C5.47873 4.66232 5.00066 5.28821 5.00066 6.59049V11.9512C5.00066 13.2535 5.47873 13.8962 6.51203 13.8962C7.54479 13.8962 8.0232 13.2535 8.0232 11.9512V8.90741C8.0232 7.58817 8.44431 6.91179 9.53458 6.91179C10.5104 6.91179 10.893 7.58817 10.893 8.94108V11.9512C10.893 13.2535 11.3711 13.8962 12.4044 13.8962C13.4375 13.8962 13.9157 13.2535 13.9157 11.9512V8.90741C13.9157 7.58817 14.3365 6.91179 15.4269 6.91179C16.4027 6.91179 16.8045 7.58817 16.8045 8.94108V11.9512Z\"/\u003e\u003cpath d=\"M3.31675 6.59049C3.31675 5.28821 2.83866 4.66232 1.82471 4.66232C0.791758 4.66232 0.313354 5.28821 0.313354 6.59049V11.9512C0.313354 13.2535 0.791758 13.8962 1.82471 13.8962C2.85798 13.8962 3.31675 13.2535 3.31675 11.9512V6.59049Z\" /\u003e\u003cpath d=\"M1.87209 0.400291C0.843612 0.400291 0 1.1159 0 1.98861C0 2.87869 0.822846 3.57676 1.87209 3.57676C2.90056 3.57676 3.7234 2.87869 3.7234 1.98861C3.7234 1.1159 2.90056 0.400291 1.87209 0.400291Z\" fill=\"#1BB76E\"/\u003e\u003c/svg\u003e\u003c/a\u003e",
            contentPolicyHtml: "User contributions licensed under \u003ca href=\"https://stackoverflow.com/help/licensing\"\u003eCC BY-SA\u003c/a\u003e \u003ca href=\"https://stackoverflow.com/legal/content-policy\"\u003e(content policy)\u003c/a\u003e",
            allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer",
          enableTables: true,
          isStacksEditorPreviewEnabled: false,
          immediatelyShowMarkdownHelp: true,
          enableTables: true,
          enableSnippets: true
        });
      }
    });
  </script>
  <div id="post-editor" class="post-editor js-post-editor">
    <div class="ps-relative">
      <div class="wmd-container mb8">
        <div id="wmd-button-bar" class="wmd-button-bar btr-sm">
          <ul id="wmd-button-row" class="wmd-button-row">
            <li id="wmd-bold-button" class="wmd-button" style="left: 0px;"><span style="background-position: 0px -20px;"></span></li>
            <li id="wmd-italic-button" class="wmd-button" style="left: 25px;"><span style="background-position: -20px -20px;"></span></li>
            <li id="wmd-spacer1" class="wmd-spacer" style="left: 50px;"><span style="background-position: -40px -20px;"></span></li>
            <li id="wmd-link-button" class="wmd-button" style="left: 75px;"><span style="background-position: -40px -20px;"></span></li>
            <li id="wmd-quote-button" class="wmd-button" style="left: 100px;"><span style="background-position: -60px -20px;"></span></li>
            <li id="wmd-code-button" class="wmd-button" style="left: 125px;"><span style="background-position: -80px -20px;"></span></li>
            <li id="wmd-image-button" class="wmd-button" style="left: 150px;"><span style="background-position: -100px -20px;"></span></li>
            <li id="wmd-spacer2" class="wmd-spacer" style="left: 175px;"><span style="background-position: -120px -20px;"></span></li>
            <li id="wmd-olist-button" class="wmd-button" style="left: 200px;"><span style="background-position: -120px -20px;"></span></li>
            <li id="wmd-ulist-button" class="wmd-button" style="left: 225px;"><span style="background-position: -140px -20px;"></span></li>
            <li id="wmd-heading-button" class="wmd-button" style="left: 250px;"><span style="background-position: -160px -20px;"></span></li>
            <li id="wmd-hr-button" class="wmd-button" style="left: 275px;"><span style="background-position: -180px -20px;"></span></li>
            <li id="wmd-spacer3" class="wmd-spacer" style="left: 300px;"><span style="background-position: -200px -20px;"></span></li>
            <li id="wmd-undo-button" class="wmd-button" style="left: 325px;"><span style="background-position: -200px -20px;"></span></li>
            <li id="wmd-redo-button" class="wmd-button" style="left: 350px;"><span style="background-position: -220px -20px;"></span></li>
            <li class="wmd-spacer wmd-spacer-max"></li>
          </ul>
        </div>
        <div class="js-stacks-validation">
          <div class="ps-relative">
            <textarea id="wmd-input" name="post-text" class="wmd-input s-input bar0 js-post-body-field" data-editor-type="wmd" data-post-type-id="2" cols="92" rows="15" aria-labelledby="your-answer-header" tabindex="101"
              data-min-length=""></textarea>
          </div>
          <div class="s-input-message mt4 d-none js-stacks-validation-message"></div>
        </div>
      </div>
    </div>
    <aside class="d-flex ai-start jc-space-between js-answer-help s-notice s-notice__warning pb0 pr4 pt4 mb8 d-none" role="status" aria-hidden="true">
      <div class="flex--item pt8">
        <p>Thanks for contributing an answer to Stack Overflow!</p>
        <ul>
          <li>Please be sure to <em>answer the question</em>. Provide details and share your research!</li>
        </ul>
        <p>But <em>avoid</em> …</p>
        <ul>
          <li>Asking for help, clarification, or responding to other answers.</li>
          <li>Making statements based on opinion; back them up with references or personal experience.</li>
        </ul>
        <p>To learn more, see our <a href="/help/how-to-answer">tips on writing great answers</a>.</p>
      </div>
      <button class="flex--item js-answer-help-close-btn s-btn s-btn__muted fc-dark">
        <svg aria-hidden="true" class="svg-icon iconClear" width="18" height="18" viewBox="0 0 18 18">
          <path d="M15 4.41 13.59 3 9 7.59 4.41 3 3 4.41 7.59 9 3 13.59 4.41 15 9 10.41 13.59 15 15 13.59 10.41 9 15 4.41Z"></path>
        </svg>
      </button>
    </aside>
    <div>
      <div id="draft-saved" class="fc-success h24" style="display:none;">Draft saved</div>
      <div id="draft-discarded" class="fc-error h24" style="display:none;">Draft discarded</div>
    </div>
    <div id="wmd-preview" class="s-prose mb16 wmd-preview js-wmd-preview"></div>
    <div></div>
    <div class="edit-block">
      <input id="fkey" name="fkey" type="hidden" value="325b025e74d0775c7a2c4a232137fb77cd3a0d7daa22a302b357129f2aa9669e">
      <input id="author" name="author" type="text">
    </div>
  </div>
  <div class="ps-relative">
    <div class="form-item new-post-login p0 my16">
      <div class="d-flex gs16 md:fd-column new-login-form">
        <div class="d-flex fd-column w50 md:w-auto gsy gs8 jc-space-between new-login-left">
          <h3 class="flex--item fs-title">Sign up or
            <a id="login-link" href="/users/login?ssrc=question_page&amp;returnurl=https%3a%2f%2fstackoverflow.com%2fquestions%2f9445489%2fperforming-http-requests-with-curl-using-proxy%23new-answer">log in</a></h3>
          <script>
            StackExchange.ready(function() {
              StackExchange.helpers.onClickDraftSave('#login-link');
              var $window = $(window),
                onScroll = function(e) {
                  var $elem = $('.new-login-left'),
                    docViewTop = $window.scrollTop(),
                    docViewBottom = docViewTop + $window.height(),
                    elemTop = $elem.offset().top,
                    elemBottom = elemTop + $elem.height();
                  if ((docViewTop < elemTop) && (docViewBottom > elemBottom)) {
                    StackExchange.using('gps', function() {
                      StackExchange.gps.track('embedded_signup_form.view', {
                        location: 'question_page'
                      });
                    });
                    $window.unbind('scroll', onScroll);
                  }
                };
              $window.on('scroll', onScroll);
            });
          </script>
          <div class="flex--item s-btn s-btn__muted s-btn__outlined s-btn__icon google-login" data-ga="[&quot;sign up&quot;,&quot;Sign Up Started - Google&quot;,&quot;New Post&quot;,null,null]">
            <svg aria-hidden="true" class="native svg-icon iconGoogle" width="18" height="18" viewBox="0 0 18 18">
              <path d="M16.51 8H8.98v3h4.3c-.18 1-.74 1.48-1.6 2.04v2.01h2.6a7.8 7.8 0 0 0 2.38-5.88c0-.57-.05-.66-.15-1.18Z" fill="#4285F4"></path>
              <path d="M8.98 17c2.16 0 3.97-.72 5.3-1.94l-2.6-2a4.8 4.8 0 0 1-7.18-2.54H1.83v2.07A8 8 0 0 0 8.98 17Z" fill="#34A853"></path>
              <path d="M4.5 10.52a4.8 4.8 0 0 1 0-3.04V5.41H1.83a8 8 0 0 0 0 7.18l2.67-2.07Z" fill="#FBBC05"></path>
              <path d="M8.98 4.18c1.17 0 2.23.4 3.06 1.2l2.3-2.3A8 8 0 0 0 1.83 5.4L4.5 7.49a4.77 4.77 0 0 1 4.48-3.3Z" fill="#EA4335"></path>
            </svg> Sign up using Google
          </div>
          <div class="flex--item s-btn s-btn__muted s-btn__icon facebook-login" data-ga="[&quot;sign up&quot;,&quot;Sign Up Started - Facebook&quot;,&quot;New Post&quot;,null,null]">
            <svg aria-hidden="true" class="svg-icon iconFacebook" width="18" height="18" viewBox="0 0 18 18">
              <path d="M3 1a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h12a2 2 0 0 0 2-2V3a2 2 0 0 0-2-2H3Zm6.55 16v-6.2H7.46V8.4h2.09V6.61c0-2.07 1.26-3.2 3.1-3.2.88 0 1.64.07 1.87.1v2.16h-1.29c-1 0-1.19.48-1.19 1.18V8.4h2.39l-.31 2.42h-2.08V17h-2.5Z"
                fill="#4167B2"></path>
            </svg> Sign up using Facebook
          </div>
          <div class="flex--item s-btn s-btn__muted s-btn__outlined s-btn__icon stackexchange-login" data-ga="[&quot;sign up&quot;,&quot;Sign Up Navigation&quot;,&quot;New Post&quot;,null,null]">
            <svg aria-hidden="true" class="native svg-icon iconLogoGlyphXSm" width="18" height="18" viewBox="0 0 18 18">
              <path d="M14 16v-5h2v7H2v-7h2v5h10Z" fill="#BCBBBB"></path>
              <path d="m12.09.72-1.21.9 4.5 6.07 1.22-.9L12.09.71ZM5 15h8v-2H5v2Zm9.15-5.87L8.35 4.3l.96-1.16 5.8 4.83-.96 1.16Zm-7.7-1.47 6.85 3.19.63-1.37-6.85-3.2-.63 1.38Zm6.53 5L5.4 11.39l.38-1.67 7.42 1.48-.22 1.46Z" fill="#F48024"></path>
            </svg> Sign up using Email and Password
          </div>
        </div>
        <input type="hidden" name="use-facebook" class="use-facebook" value="false">
        <input type="hidden" name="use-google" class="use-google" value="false">
        <button type="button" class="d-none js-submit-openid">Submit</button>
        <div class="d-flex gsy gs8 fd-column w50 md:w-auto new-login-right form-item p0">
          <h3 class="flex--item fs-title">Post as a guest</h3>
          <div class="flex--item">
            <div class="d-flex gs4 gsy fd-column">
              <label class="s-label" for="display-name">Name</label>
              <div class="d-flex ps-relative">
                <input class="s-input" id="display-name" name="display-name" maxlength="30" type="text" value="" tabindex="105" placeholder="">
              </div>
            </div>
          </div>
          <div class="flex--item">
            <div class="d-flex gs4 gsy fd-column">
              <div class="flex--item">
                <div class="d-flex gs2 gsy fd-column">
                  <label class="flex--item s-label" for="m-address">Email</label>
                  <p class="flex--item s-description">Required, but never shown</p>
                </div>
              </div>
              <div class="d-flex ps-relative">
                <input class="s-input js-post-email-field" id="m-address" name="m-address" type="text" value="" size="40" tabindex="106" placeholder="">
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <script>
      StackExchange.ready(function() {
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f9445489%2fperforming-http-requests-with-curl-using-proxy%23new-answer', 'question_page');
      });
    </script>
    <noscript>
      <h3 class="flex--item fs-title">Post as a guest</h3>
      <div class="flex--item">
        <div class="d-flex gs4 gsy fd-column">
          <label class="s-label" for="display-name">Name</label>
          <div class="d-flex ps-relative">
            <input class="s-input" id="display-name" name="display-name" maxlength="30" type="text" value="" tabindex="105" placeholder="">
          </div>
        </div>
      </div>
      <div class="flex--item">
        <div class="d-flex gs4 gsy fd-column">
          <div class="flex--item">
            <div class="d-flex gs2 gsy fd-column">
              <label class="flex--item s-label" for="m-address">Email</label>
              <p class="flex--item s-description">Required, but never shown</p>
            </div>
          </div>
          <div class="d-flex ps-relative">
            <input class="s-input js-post-email-field" id="m-address" name="m-address" type="text" value="" size="40" tabindex="106" placeholder="">
          </div>
        </div>
      </div>
    </noscript>
  </div>
  <div class="form-submit clear-both d-flex gsx gs4">
    <button id="submit-button" class="flex--item s-btn s-btn__primary s-btn__icon" type="submit" tabindex="120" autocomplete="off"> Post Your Answer </button>
    <button class="flex--item s-btn s-btn__danger discard-answer dno"> Discard </button>
    <p class="privacy-policy-agreement"> By clicking “Post Your Answer”, you agree to our <a href="https://stackoverflow.com/legal/terms-of-service/public" name="tos" target="_blank" class="-link">terms of service</a>,
      <a href="https://stackoverflow.com/legal/privacy-policy" name="privacy" target="_blank" class="-link">privacy policy</a> and
      <a href="https://stackoverflow.com/legal/cookie-policy" name="cookie" target="_blank" class="-link">cookie policy</a><input type="hidden" name="legalLinksShown" value="1">
    </p>
  </div>
  <div class="js-general-error general-error clear-both d-none" aria-live="polite"></div>
</form>

Text Content

Stack Overflow
 1. About
 2. Products
 3. For Teams

 1. Stack Overflow Public questions & answers
 2. Stack Overflow for Teams Where developers & technologists share private
    knowledge with coworkers
 3. Talent Build your employer brand
 4. Advertising Reach developers & technologists worldwide
 5. About the company

Loading…




 1. CURRENT COMMUNITY
    
    
     * 
       Stack Overflow
       help chat
     * 
       Meta Stack Overflow
    
    
    YOUR COMMUNITIES
    
    Sign up or log in to customize your list.
    
    
    MORE STACK EXCHANGE COMMUNITIES
    
    company blog
    
 2. 
 3. Log in
 4. Sign up

 1. Home
 2. 1. Public
    2. Questions
    3. Tags
    4. Users
    5. Companies
    6. Collectives
       
    7. Explore Collectives
 3. 1. Teams
       Stack Overflow for Teams – Start collaborating and sharing organizational
       knowledge. Create a free Team Why Teams?
    2. Teams
       
    3. Create free Team

Stack Overflow for Teams is moving to its own domain! When the migration is
complete, you will access your Teams at stackoverflowteams.com, and they will no
longer appear in the left sidebar on stackoverflow.com.

Check your email for updates.

COLLECTIVES™ ON STACK OVERFLOW

Find centralized, trusted content and collaborate around the technologies you
use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy
to search.

Learn more about Teams



PERFORMING HTTP REQUESTS WITH CURL (USING PROXY)

Ask Question
Asked 10 years, 9 months ago
Modified 5 months ago
Viewed 1.3m times
Report this ad
This question shows research effort; it is useful and clear

563
This question does not show any research effort; it is unclear or not useful

Save this question.

Show activity on this post.


I have this proxy address: 125.119.175.48:8909

How can I perform a HTTP request using cURL like curl http://www.example.com,
but specifying the proxy address of my network?

 * linux
 * curl
 * proxy

Share
Share a link to this question

Copy linkCC BY-SA 3.0

Improve this question
Follow
Follow this question to receive notifications


edited Aug 22, 2017 at 20:27

ivanleoncz
8,22755 gold badges5454 silver badges4848 bronze badges
asked Feb 25, 2012 at 15:47

user873286user873286
7,53977 gold badges2929 silver badges3838 bronze badges
0
Add a comment  | 



17 ANSWERS 17

Sorted by: Reset to default
Highest score (default) Trending (recent votes count more) Date modified (newest
first) Date created (oldest first)
This answer is useful

775
This answer is not useful

Save this answer.


Show activity on this post.


From man curl:

-x, --proxy <[protocol://][user:password@]proxyhost[:port]>

     Use the specified HTTP proxy. 
     If the port number is not specified, it is assumed at port 1080.


Share
Share a link to this answer

Copy linkCC BY-SA 3.0

Improve this answer
Follow
Follow this answer to receive notifications


edited Oct 15, 2013 at 21:57

Ben G
25.7k3434 gold badges100100 silver badges166166 bronze badges
answered Feb 25, 2012 at 15:51

Karl BarkerKarl Barker
10.9k33 gold badges2020 silver badges2626 bronze badges
5
 * curl: (7) couldn't connect to host curl: (7) couldn't connect to host
   – user873286
   Feb 27, 2012 at 22:50
 * I get above error when I run this command: curl -x, --proxy 122.72.2.200:80
   mysite.com/test.php?id=1
   – user873286
   Feb 27, 2012 at 22:52
 * 79
   "-x, --proxy" means that either one can be used. The command should be either
   "curl -x 122.72.2.200:80 mysite.com/test.php?id=1" or "curl --proxy
   122.72.2.200:80 mysite.com/test.php?id=1"
   – IBBoard
   Dec 4, 2012 at 11:39
 * 9
   The docs are correctly quoted as above, however, the user and password should
   be expressed differently: -x user:password@proxyhost:port
   – Ed Chapel
   Sep 7, 2013 at 12:14
 * if you need to curl and get via proxy do curl -x GET mysite.com --proxy
   yourproxy:port
   – Raymond
   Sep 6, 2017 at 3:48

Add a comment  | 
Report this ad
This answer is useful

484
This answer is not useful

Save this answer.


Show activity on this post.


General way:

export http_proxy=http://your.proxy.server:port/


Then you can connect through proxy from (many) application.

And, as per comment below, for https:

export https_proxy=https://your.proxy.server:port/


Share
Share a link to this answer

Copy linkCC BY-SA 4.0

Improve this answer
Follow
Follow this answer to receive notifications


edited Jun 19, 2019 at 14:04


answered Feb 25, 2012 at 19:51

airweenairween
5,85111 gold badge1313 silver badges1919 bronze badges
13
 * 79
   When you need to proxy HTTPS traffic, the environment variable is upper case:
   HTTPS_PROXY
   – phatblat
   Nov 14, 2012 at 16:38
 * 23
   From the man pages The environment variables can be specified in lower case
   or upper case. The lower case version has precedence. http_proxy is an
   exception as it is only available in lower case. Using an environment
   variable to set the proxy has the same effect as using the --proxy option.
   – Captain Lepton
   Jun 19, 2013 at 14:23
 * @BipinVayalu, what do you want to check? At this way, what I describe above,
   the client uses the proxy "direct way", not transparently. So, the proxy
   gives the standard HTTP answers (including HTTP codes). If you export a wrong
   http_proxy environment variable (eg. bad port...), the client could't connet
   to that, and it gives an error message: "Warning! Couldn't connect to remote
   host!", or something similar - just try it :)
   – airween
   May 23, 2014 at 9:18
 * 15
   If you check curl source code, you will see at url.c(line 4337 in verion
   7.39) they check for lowercase version and if they can't find it, check for
   the uppercase.
   – Jose Palma
   Nov 24, 2014 at 14:17
 * 1
   Most users sent me a correction, now I share that. If you want to use HTTPS
   connection through proxy, then you should do this: export
   https_proxy=your.proxy.server:port Note, that there is "http" proto in URL
   schema, not httpS!
   – airween
   Aug 23, 2015 at 18:59

 |  Show 8 more comments
This answer is useful

160
This answer is not useful

Save this answer.


Show activity on this post.


The above solutions might not work with some curl versions I tried them for
myself(curl 7.22.0). But what worked for me was:

curl -x http://proxy_server:proxy_port --proxy-user username:password -L http://url


Hope it solves the issue better!

Share
Share a link to this answer

Copy linkCC BY-SA 3.0

Improve this answer
Follow
Follow this answer to receive notifications


answered Feb 11, 2014 at 10:14

AmarAmar
2,12111 gold badge1212 silver badges1616 bronze badges
2
 * Run into the same issue, the curl shipped by Debian Wheezy still doesn't
   support the env trick
   – hyperknot
   Aug 19, 2014 at 15:41
 * Got this instead [1] 4812
   – Aminah Nuraini
   Feb 19, 2017 at 21:07

Add a comment  | 

This answer is useful

102
This answer is not useful

Save this answer.


Show activity on this post.


Beware that if you are using a SOCKS proxy, instead of a HTTP/HTTPS proxy, you
will need to use the --socks5 switch instead:

curl --socks5 125.119.175.48:8909 http://example.com/


You can also use --socks5-hostname instead of --socks5 to resolve DNS on the
proxy side.

Share
Share a link to this answer

Copy linkCC BY-SA 4.0

Improve this answer
Follow
Follow this answer to receive notifications


edited May 13, 2019 at 17:30


answered Aug 28, 2014 at 16:57

Filipe CorreiaFilipe Correia
5,12566 gold badges3030 silver badges4646 bronze badges
4
 * 7
   This didn't work for me, but using --socks5-hostname did.
   – Michał Rybak
   Apr 14, 2016 at 19:28
 * 2
   @MichałRybak that will work the same but resolve DNS on the proxy side. See
   the man page for more details.
   – Filipe Correia
   Apr 15, 2016 at 9:32
 * 3
   curl https://api.ipify.org --proxy socks5://189.100.246.182:37339 seems to
   work fine for me. Is the --proxy option in some way inferior to --socks5 when
   using socks5 proxies?
   – user993683
   Jul 5, 2017 at 12:38
 * @user993683 It's version-dependent. --proxy is probably what you want, now,
   but it wasn't always supported. Also note that socks5:// and socks5h://
   perform hostname (DNS) resolution before and after connecting to the proxy,
   respectively.
   – Michael
   May 9, 2019 at 16:23

Add a comment  | 
This answer is useful

59
This answer is not useful

Save this answer.


Show activity on this post.


as an adition to airween, another good idea is to add this into your .bashrc, so
you'll be able to switch from non proxied to proxied environment:

alias proxyon="export http_proxy='http://YOURPROXY:YOURPORT';export https_proxy='http://YOURPROXY:YOURPORT'"
alias proxyoff="export http_proxy='';export https_proxy=''"


WHERE YOURPROXY:YOURPORT is exactly that, your ip and port proxy :-).

Then, simply doing

proxyon


your system will start to use the proxy, and just the opposite with:

proxyoff


Share
Share a link to this answer

Copy linkCC BY-SA 3.0

Improve this answer
Follow
Follow this answer to receive notifications


answered May 22, 2014 at 8:03

Alejandro MorenoAlejandro Moreno
5,40022 gold badges3131 silver badges2929 bronze badges
2
 * unset http_prox ;) !
   – cedrik
   Nov 17, 2020 at 14:41
 * your system will start to use the proxy not completely correct, you will
   start/stop only in current shell and subshells
   – Narcolessico
   Jan 27 at 15:04

Add a comment  | 
This answer is useful

40
This answer is not useful

Save this answer.


Show activity on this post.


use the following

curl -I -x 192.168.X.X:XX http://google.com

192.168.X.X:XX put your proxy server ip and port.

-v verbose mode it will give more details including headers and response.

Share
Share a link to this answer

Copy linkCC BY-SA 3.0

Improve this answer
Follow
Follow this answer to receive notifications


edited Aug 26, 2015 at 6:27

CommunityBot
111 silver badge
answered Jan 29, 2015 at 16:48

13krn13krn
53144 silver badges99 bronze badges
2
 * 2
   This should be the answer. Not everyone wants to specify a global variable
   (export) for every HTTP request performed by every HTTP client on your host.
   This option gives more flexibility, IMHO.
   – ivanleoncz
   Aug 22, 2017 at 15:44
 * This is so useful when you're trying different proxies against an url.
   Thanks.
   – redAce
   Oct 2, 2018 at 13:51

Add a comment  | 
This answer is useful

30
This answer is not useful

Save this answer.


Show activity on this post.


I like using this in order to get the IP under which I am seen

curl -x http://proxy_server:proxy_port https://api.ipify.org?format=json && echo


Hope this helps someone.

Share
Share a link to this answer

Copy linkCC BY-SA 3.0

Improve this answer
Follow
Follow this answer to receive notifications


answered Sep 4, 2017 at 14:11

bmetgebmetge
32133 silver badges44 bronze badges
Add a comment  | 
This answer is useful

26
This answer is not useful

Save this answer.


Show activity on this post.


For curl you can configure proxy in your ~/.curlrc (_curlrc on Windows) file by
adding proxy value, the syntax is:

proxy = http://username:password@proxy-host:port


Share
Share a link to this answer

Copy linkCC BY-SA 4.0

Improve this answer
Follow
Follow this answer to receive notifications


edited Jan 11, 2019 at 12:58


answered Mar 5, 2016 at 14:16

kenorbkenorb
147k7777 gold badges660660 silver badges715715 bronze badges
2
 * That's it! Configured the proxy setting some years ago in that file and
   wondered today, why curl doesn't work anymore now the proxy adress changed
   and the env vars are all set correct. Thanks for that!
   – emale
   Mar 19, 2019 at 9:29
 * On Windows, the "_curlrc" file can (must?) be placed into the "%APPDATA%"
   directory.
   – Fred Danna
   Oct 1, 2021 at 16:03

Add a comment  | 
This answer is useful

22
This answer is not useful

Save this answer.


Show activity on this post.


curl -I "https://www.google.com" -x 1.1.1.1:8080

Share
Share a link to this answer

Copy linkCC BY-SA 4.0

Improve this answer
Follow
Follow this answer to receive notifications


edited Dec 7, 2021 at 13:02

evandrix
5,95544 gold badges2727 silver badges3737 bronze badges
answered Sep 6, 2019 at 9:52

Debashish SahaDebashish Saha
22922 silver badges22 bronze badges
1
 * 12
   Consider adding explanation to your solution.
   – Pochmurnik
   Sep 6, 2019 at 9:58

Add a comment  | 
This answer is useful

16
This answer is not useful

Save this answer.


Show activity on this post.


Just summarizing all great mentioned answers:

curl -x http://<user>:<pass>@<proxyhost>:<port>/ -o <filename> -L <link>


Share
Share a link to this answer

Copy linkCC BY-SA 4.0

Improve this answer
Follow
Follow this answer to receive notifications


answered May 11, 2018 at 13:51

Morteza MashayekhiMorteza Mashayekhi
9141111 silver badges2323 bronze badges
Add a comment  | 
This answer is useful

10
This answer is not useful

Save this answer.


Show activity on this post.


With a proxy with authentication I use:

curl -x <protocol>://<user>:<password>@<host>:<port> --proxy-anyauth <url>


because, I don't know why curl doesn't use/catch http[s]_proxy environment
variables.

Share
Share a link to this answer

Copy linkCC BY-SA 3.0

Improve this answer
Follow
Follow this answer to receive notifications


answered May 31, 2017 at 6:39

Pedro R. Sánchez A.Pedro R. Sánchez A.
10111 silver badge55 bronze badges
Add a comment  | 
This answer is useful

5
This answer is not useful

Save this answer.


Show activity on this post.


You don't need to export the http[s]_proxy shell variable if you're just setting
the proxy for a one off command. e.g.

http_proxy=http://your.proxy.server:port curl http://www.example.com


That said, I'd prefer curl -x if I knew I was always going to use a proxy.

Share
Share a link to this answer

Copy linkCC BY-SA 3.0

Improve this answer
Follow
Follow this answer to receive notifications


answered Mar 27, 2017 at 18:03

overthinkoverthink
23.7k44 gold badges6565 silver badges6969 bronze badges
Add a comment  | 
This answer is useful

4
This answer is not useful

Save this answer.


Show activity on this post.


sudo curl -x http://10.1.1.50:8080/ -fsSL https://download.docker.com/linux/ubuntu/gpg


> This worked perfectly for me, the error comes because curl need to set the
> proxy
> 
> Remmember replace the proxy with your proxy, mine, "example" was
> http://10.1.1.50:8080/.

Share
Share a link to this answer

Copy linkCC BY-SA 4.0

Improve this answer
Follow
Follow this answer to receive notifications


answered Jun 11, 2019 at 16:26

IbarMarioIbarMario
5122 bronze badges
Add a comment  | 
This answer is useful

4
This answer is not useful

Save this answer.


Show activity on this post.


curl -vv -ksL "https://example.com" -x "http://<proxy>:<port>"

Share
Share a link to this answer

Copy linkCC BY-SA 4.0

Improve this answer
Follow
Follow this answer to receive notifications


edited Dec 7, 2021 at 13:02

evandrix
5,95544 gold badges2727 silver badges3737 bronze badges
answered Jul 23, 2020 at 8:00

iamtheexp01iamtheexp01
3,42699 gold badges3535 silver badges3535 bronze badges
Add a comment  | 
This answer is useful

2
This answer is not useful

Save this answer.


Show activity on this post.


Depending on your workplace, you may also need to specify the -k or the
--insecure option for curl in order to get past potential issues with CA
certificates.

curl -x <myCompanyProxy>:<port> -k -O -L <link to file to download>


Share
Share a link to this answer

Copy linkCC BY-SA 3.0

Improve this answer
Follow
Follow this answer to receive notifications


answered Jan 11, 2018 at 20:59

Matt LeglerMatt Legler
5955 bronze badges
Add a comment  | 
This answer is useful

0
This answer is not useful

Save this answer.


Show activity on this post.


In case the proxy is using automatic proxy with PAC file. We can find the actual
proxy from the javascript from the PAC URL.

And if the proxy needs authentication, we can first use a normal web-browser to
access the website which will promote authentication dialog. After
authentication, we can use wireshark to capture the http package sends to the
proxy server, from the http package, we can get the auth token from http header:
Proxy-Authorization

Then we can set the http_proxy environment variable and also include auth token
in the http header: Proxy-Authorization

export http_proxy=http://proxyserver:port

curl -H "Proxy-Authorization: xxxx" http://targetURL

Share
Share a link to this answer

Copy linkCC BY-SA 3.0

Improve this answer
Follow
Follow this answer to receive notifications


edited Aug 24, 2017 at 0:44


answered Jun 24, 2017 at 5:49

Jianwu ChenJianwu Chen
4,97333 gold badges2828 silver badges3232 bronze badges
Add a comment  | 
This answer is useful

0
This answer is not useful

Save this answer.


Show activity on this post.


curl -x socks5://username:password@ip:port example.com


Share
Share a link to this answer

Copy linkCC BY-SA 4.0

Improve this answer
Follow
Follow this answer to receive notifications


edited Jun 23 at 21:51

S.B
10.6k77 gold badges2020 silver badges4141 bronze badges
answered Jun 22 at 20:27

MohammadReza HosseiniMohammadReza Hosseini
34111 gold badge33 silver badges1515 bronze badges
Add a comment  | 


YOUR ANSWER

 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 



Thanks for contributing an answer to Stack Overflow!

 * Please be sure to answer the question. Provide details and share your
   research!

But avoid …

 * Asking for help, clarification, or responding to other answers.
 * Making statements based on opinion; back them up with references or personal
   experience.

To learn more, see our tips on writing great answers.

Draft saved
Draft discarded





SIGN UP OR LOG IN

Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Submit


POST AS A GUEST

Name

Email

Required, but never shown




POST AS A GUEST

Name

Email

Required, but never shown


Post Your Answer Discard

By clicking “Post Your Answer”, you agree to our terms of service, privacy
policy and cookie policy


NOT THE ANSWER YOU'RE LOOKING FOR? BROWSE OTHER QUESTIONS TAGGED
 * LINUX
 * CURL
 * PROXY

OR ASK YOUR OWN QUESTION.

 * The Overflow Blog
 * When to use gRPC vs GraphQL
 * Featured on Meta
 * Inbox improvements will go live for everyone on November 29th, 2022
 * Help us identify new roles for community members
 * 2022 Community Moderator Election Results
 * The [collapse] tag is being burninated
 * Help needed: a call for volunteer reviewers for the Staging Ground beta test

Report this ad
Report this ad


LINKED

115
How do I set up curl to permanently use a proxy?
6
Scrapy ERROR: Error downloading - Could not open CONNECT tunnel
10
HTTPS request using Curl through squid proxy
2
Problem with a curl parameter in OS Process Sampler
3
cURL results in 503; page works fine in browser.
2
Testcafe: Failed to find a dns-record for the resource
1
Curl function cannot parse proxy coming from a variable in bash
0
Error 'event handler' not 'handling' ECONNRESET
0
how can I post to api running on remote desktop?
1
Configure jMeter Http Request to emulate this curl command
See more linked questions

RELATED

1873
How to send a header using a HTTP request through a cURL call?
1013
Getting Git to work with a proxy server - fails with "Request timed out"
608
PHP, cURL, and HTTP POST example?
612
Using cURL with a username and password?
728
How to display request headers with command line curl
3592
How do I POST JSON data with cURL?
683
Getting only response header from HTTP POST using cURL
529
Using cURL to upload POST data with files
449
How can I connect to a Tor hidden service using cURL in PHP?
945
How do I measure request and response times at once using cURL?

HOT NETWORK QUESTIONS

 * 
   What real castle would be least expensive to visit from New Zealand?
 * 
   Why create a CSR on my own server to have it signed by a 3rd party?
 * 
   Does canon mention Helga Hufflepuff's chamber?
 * 
   How can I figure out measurements/distances and hyperspace jump time in my
   universe that is simple enough for readers to understand?
 * 
   Does the order of referees matter?
 * 
   How to read in order to improve my writing skills?
 * 
   How can an ensemble be more accurate than the best base classifier in that
   ensemble?
 * 
   Replace a line of text in a file, with the contents of another file
 * 
   TV pseudo-documentary featuring humans defending the Earth from a huge alien
   ship using manhole covers
 * 
   Why did Phil do this to Howard at the end of “Uncut Gems?”
 * 
   How do hair cells recognize frequencies?
 * 
   Is there a general way to propose research to the community?
 * 
   What is a quick way to write "dagger" sign in MS Word equation mode?
 * 
   Why do airplanes usually pitch nose-down in a stall?
 * 
   What's special about spoke nipple washers?
 * 
   80's/90's novel about a post-apocalyptic gunman, NOT GUNSLINGER, ending with
   the first atomic bomb test?
 * 
   How do Biblical Unitarians deal with the fact that the early church accepted
   the divinity of Christ?
 * 
   Is there a much simplified version of the Old Testament?
 * 
   In the envelope system, how often do I "clear" my envelopes?
 * 
   Why is the answer "it" --> 'Mr. Akagi was unable to buy tickets for the
   concert because it/they was sold out'
 * 
   Shortest path between two directories
 * 
   Boundedness of a Hamiltonian and when does a Hamiltonian have a spectrum?
 * 
   Matches, mismatches and indels
 * 
   Orbital Supercomputer for Martian and Outer Planet Computing

Question feed


SUBSCRIBE TO RSS

Question feed

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.





STACK OVERFLOW

 * Questions
 * Help

PRODUCTS

 * Teams
 * Advertising
 * Collectives
 * Talent

COMPANY

 * About
 * Press
 * Work Here
 * Legal
 * Privacy Policy
 * Terms of Service
 * Contact Us
 * Cookie Settings
 * Cookie Policy

STACK EXCHANGE NETWORK

 * Technology
 * Culture & recreation
 * Life & arts
 * Science
 * Professional
 * Business
 * API
 * Data

 * Blog
 * Facebook
 * Twitter
 * LinkedIn
 * Instagram

Site design / logo © 2022 Stack Exchange Inc; user contributions licensed under
CC BY-SA. rev 2022.11.28.43052

Your privacy

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on
your device and disclose information in accordance with our Cookie Policy.

Accept all cookies Customize settings