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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:28:43+00:00 2026-05-27T23:28:43+00:00

Whats wrong with this raw HTTP call using fsockopen? POST /api/?action=report HTTP/1.1 Host: www.webhosting-performance.com

  • 0

Whats wrong with this raw HTTP call using fsockopen?

POST /api/?action=report HTTP/1.1
Host: www.webhosting-performance.com
Content-Type: application/x-www-form-urlencoded
Conent-Length: 9
Connection: close

test=test

The remote script says var_dump($_POST) is empty.

A snippet of my php code looks like this:

if (ini_get('allow_url_fopen') > 0) {

  $parts = parse_url($url);
  $fp = fsockopen($parts['host'], isset($parts['port']) ? $parts['port'] : 80, $errno, $errstr, 30);

  if (!$fp) throw new Exception("Problem with $url, $errstr");

  $post_string = $post_fields ? http_build_query($post_fields) : '';

  $out = ($post_string ? "POST " : "GET ") . $parts['path'] . ((isset($parts['query'])) ? "?" . $parts['query'] : false) ." HTTP/1.1\r\n"
       . "Host: ". $parts['host'] ."\r\n"
       . ($post_string ? "Content-Type: application/x-www-form-urlencoded\r\n" : false)
       . "Conent-Length: ". strlen($post_string) ."\r\n"
       . "Connection: close\r\n"
       . "\r\n" . $post_string;

  fwrite($fp, $out);

  // ...

} else {
  // use curl
}
  • 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-27T23:28:44+00:00Added an answer on May 27, 2026 at 11:28 pm

    You basically just have a typo:

    Conent-Length: 9
    

    See the missing t in Content-Length:

    The real question is (not to malign your efforts at constructing something yourself), why aren’t you using cURL or PEARs HTTP Request class?

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

Sidebar

Related Questions

Whats wrong with this code? -(void) drawRect:(CGRect) rect { CGContextRef c = UIGraphicsGetCurrentContext(); if
Whats wrong with this picture? Model: validates_acceptance_of :terms_of_service, :on => :create, :accept => true,
whats wrong with this? anybody help me please.. if(stripos($nerde, $hf) !== false) && (stripos($nerde,
Whats wrong with the following c# code? Compiler reports this error: Inconsistent accessibility: parameter
I got this error message and I'm not quite sure whats wrong: Exception in
I have problem compilin this code..can anyone tell whats wrong with the syntax CREATE
What's wrong with this function: function() { $.get('/controller/action', function(data) { $('#temporaryPhotos').text(data); } ); return
I'm looking to make an HTTP post request given the raw data that I
What is wrong on this code ? I've a Raw file in my project
I'm trying to retrieve data from http://api.freebase.com/api/trans/raw/m/0h47 As you can see in text there

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.