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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:32:59+00:00 2026-06-12T10:32:59+00:00

We are currently using sockets to open and write to a http connection, requests

  • 0

We are currently using sockets to open and write to a http connection, requests that we don’t necessarily care about the response! Like tracking pings etc

This worked on our old servers and on our windows developments environments but not on our new ubuntu servers.

The code we use is as follows

        $aUrlParts = parse_url($sUrl);

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

        $sHeader = "GET {$aUrlParts['path']}?{$aUrlParts["query"]} HTTP/1.1\r\n";
        $sHeader.= "Host: {$aUrlParts['host']}\r\n";
        $sHeader.= "Connection: Close\r\n\r\n";

        fwrite($fp, $sHeader);
        fclose($fp);

if I do a read after the fwrite i can get it all to work from the servers but this defeats the point of doing the request this way compared to just curling the URL

I have tried flush the socket and setting it to non blocking but non of that works! Just doing a read after is the only thing that works!

Any help is appreciated

Edit: I will mention these new servers are AWS based and I have a feeling the socket implementation on them may be different

  • 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-12T10:33:00+00:00Added an answer on June 12, 2026 at 10:33 am

    I am not sure that this is worthy as an answer but I had the exact same problem and that’s how I came here. My only difference was that I was trying to execute a request against the server itself.

    My solution was in the access management of the server. I had an htaccess file that was blocking anyone from viewing except for my own network and the hitch was that it was also blocking my server from requesting itself.

    So maybe it has something to do with the servers access management. Let me know if this helps.

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

Sidebar

Related Questions

I have an applet that communicates with a servlet using Http (Not sockets). Currently,
I'm working on a library that is currently using standard tcp sockets. An end
I am learning currently about client server communication using Java through sockets. First of
I am currently using the java.nio.channel.Selectors & SocketChannels for a application that will open
I currently using android NDK to write some native code in C. I have
I'm trying to download source of the site using sockets. Currently i can download
I'm writing a simple telnet client library. I open sockets using fsockopen() and read
I'm currently writing a simple client/server in Java using sockets. I want the server
We have an application that logs to files currently using streamwriter. As we are
I'm trying to write a program that uses sockets to connect with other instances

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.