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

  • SEARCH
  • Home
  • 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 6682639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:43:48+00:00 2026-05-26T04:43:48+00:00

today I was trying something using ‘lib cURL’ when I got this weird error,

  • 0

today I was trying something using ‘lib cURL’ when I got this weird error, I cannot found a solution for this, can you help me to figure it out?

<?php
set_time_limit(0);
  class cURL
  {
  var $content;
  var $cookie;
  var $headers = array();
  var $ch;
  var $data;
  var $info;
  var $httpcode;
  var $proxy_ip;
  var $proxy_port;
  var $cookie_f;

  function __construct($cookie = '')
  {
      if (!empty($cookie)) {
          $this->cookie_f = $cookie;
      }
  }

  function setproxy($proxy)
  {
      list($ip, $porta) = explode(":", $proxy);
      $this->proxy_ip = $ip;
      $this->proxy_port = $porta;
  }

  function setcookie($cookie)
  {
      $this->cookie = $cookie;
  }

  function open($type, $url)
  {
      $this->ch = curl_init();
      curl_setopt($this->ch, CURLOPT_URL, $url);      
      curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, 1);
      curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1);
      curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, false);
      curl_setopt($this->ch, CURLOPT_HEADER, true);
      //curl_setopt($this->ch, CURLOPT_HTTPHEADER, array("Content-type: application/x-www-form-urlencoded", "Content-length: 216"));
      curl_setopt($this->ch, CURLOPT_ENCODING, "");
      curl_setopt($this->ch, CURLOPT_COOKIEFILE, getcwd() . '/cookies.cookie');
      curl_setopt($this->ch, CURLOPT_COOKIEJAR, getcwd() . '/cookies.cookie');
      curl_setopt($this->ch, CURLOPT_USERAGENT, "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; pt-BR; rv:1.9.2.18) Gecko/20110614 Firefox/3.6.18");

      if (strtolower($type) == 'post') {
          curl_setopt($this->ch, CURLOPT_CUSTOMREQUEST, "POST");
          curl_setopt($this->ch, CURLOPT_POST, 1);
          curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data);
          curl_setopt($this->ch, CURLOPT_HEADER, true);
      }

      $this->content = curl_exec($this->ch);
      curl_close($this->ch);
      return $this->content;

  }
  }

?>
<?php
    $curll = New cURL;
    $curll ->setCookie = "cookies.cookie";
    $curll ->data = "username=user&password=pass&IsSyncUp=&FacebookAssociation=&SNAccessToken=";
    $curll ->open("POST", "http://www.website.com");
    $curll ->data = '__EVENTTARGET=ctl00$ctl00$cphRoblox$cphMyRobloxContent$lbSend&ctl00$ctl00$cphRoblox$cphMyRobloxContent$rbxMessageEditor$txtSubject=AAAAAAAAA&ctl00$ctl00$cphRoblox$cphMyRobloxContent$rbxMessageEditor$txtBody=BBBBBBBBB';
    $curll ->open("POST", "http://www.website.com/My/PrivateMessage.aspx?RecipientID=20815603");
    echo $curll ->content;
?>

So, my returned error was:

HTTP/1.1 302 Found Cache-Control: private Content-Type: text/html; charset=utf-8 Location: /Login/Default.aspx?ReturnUrl=%2fMy%2fPrivateMessage.aspx%3fRecipientID%3d20815603&RecipientID=20815603 Server: Microsoft-IIS/7.0 Set-Cookie: rbx-ip=; path=/; HttpOnly Set-Cookie: RBXSource=rbx_acquisition_time=10/14/2011 3:32:12 PM&rbx_acquisition_referrer=http://www.website.com/My/PrivateMessage.aspx?RecipientID=20815603&rbx_medium=Direct&rbx_source=www.website.com&rbx_campaign=&rbx_send_info=0; expires=Sun, 13-Nov-2011 21:32:12 GMT; path=/ X-AspNet-Version: 4.0.30319 X-Powered-By: ASP.NET P3P: CP=”CAO DSP COR CURa ADMa DEVa OUR IND PHY ONL UNI COM NAV INT DEM PRE” Date: Fri, 14 Oct 2011 20:32:12 GMT Content-Length: 224 HTTP/1.1 411 Length Required Content-Type: text/html; charset=us-ascii Server: Microsoft-HTTPAPI/2.0 Date: Fri, 14 Oct 2011 20:32:12 GMT Connection: close Content-Length: 344
Length Required
HTTP Error 411. The request must be chunked or have a content length.

So my problem was “The request must be chunked or have a content length.”
My POST was made by consulting browser post using ‘Live HTTP Headers’ (Mozila)

If I comment the seconds data & open/post it works fine.
The seconds data and open/post was the problem.

Can anybody help me?
Thanks for reading.

  • 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-26T04:43:48+00:00Added an answer on May 26, 2026 at 4:43 am

    It is hard to know exactly what is being sent unless you see the actual data that is being passed.

    Download the fiddler web proxy and compare the exact browser output with curl.

    http://www.fiddler2.com/fiddler2/

    add this line of PHP code to pass curl thru fiddler.

    curl_setopt($ch, CURLOPT_PROXY, '127.0.0.1:8888'); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got this error today when trying to open a Visual Studio 2008 project
I got an error today while trying to do some formatting to existing code.
I was today trying to figure out on working with WebService and found many
I'm trying to do something but I can't find any solution, I'm also having
I've got a query that presently looks something like this (I'll simplify it to
I'm trying to make something kind of fuzzy today :) I'd like to create
i was trying out quartz 2d today and i got to learn basic drawing
I noticed something when I was trying to solve a problem today. The scalar
I ran into a problem today when trying to set a field using FieldInfo.SetValue()
I learned today through this section of the MySQL documentation that prepared statements cannot

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.