fsockopen not enabled now what?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RedSon
    Recognized Expert Expert
    • Jan 2007
    • 4980

    #1

    fsockopen not enabled now what?

    Dang this free hosting site. They made it so I can't use fsockopen, which normally I wouldn't care about but I want to be able to use some anti spam type software like captcha and akismet. They said that they would turn it on again if you make a good 30 posts in their forums but that would take too long. I tried fopen but it will error if I put a URL in it. I also tried sockets but I could not get one open, I think you have to be root. Any other ideas?

    Thanks!
  • jx2
    New Member
    • Feb 2007
    • 228

    #2
    Originally posted by RedSon
    Dang this free hosting site. They made it so I can't use fsockopen, which normally I wouldn't care about but I want to be able to use some anti spam type software like captcha and akismet. They said that they would turn it on again if you make a good 30 posts in their forums but that would take too long. I tried fopen but it will error if I put a URL in it. I also tried sockets but I could not get one open, I think you have to be root. Any other ideas?

    Thanks!
    lol ive got the same problem and i have to pay for my host ;-(

    you can try to use ajax client to pass the results

    i mean:
    server->client->ajax->the url you want to ->back to ajax client-> server

    i lnow long way :-)
    but its working in most cases
    gerards
    jx2

    Comment

    • pbmods
      Recognized Expert Expert
      • Apr 2007
      • 5821

      #3
      Heya, RedSon.

      Can you use shell commands?
      [code=php]
      exec('echo "' . $text . '" > filename.txt');
      [/code]

      Comment

      • RedSon
        Recognized Expert Expert
        • Jan 2007
        • 4980

        #4
        Originally posted by pbmods
        Heya, RedSon.

        Can you use shell commands?
        [code=php]
        exec('echo "' . $text . '" > filename.txt');
        [/code]
        maybe but I am trying to connect to another website for capcha confirmation. Writing to the command line probably will not work for me :(

        Comment

        • pbmods
          Recognized Expert Expert
          • Apr 2007
          • 5821

          #5
          Good thing I'm on the ball here :P

          What about cURL?

          Comment

          • RedSon
            Recognized Expert Expert
            • Jan 2007
            • 4980

            #6
            Originally posted by pbmods
            Good thing I'm on the ball here :P

            What about cURL?
            yea!!! curl support is enabled now is there a way to write my own fsockopen function using libcurl that all my scripts will use instead of the standard fsockopen?

            Comment

            • pbmods
              Recognized Expert Expert
              • Apr 2007
              • 5821

              #7
              Heya, RedSon.

              A very basic example is located here. The general flow is the same, but everything is named differently.

              Comment

              • pbmods
                Recognized Expert Expert
                • Apr 2007
                • 5821

                #8
                Here's an example that I wrote that sends POST data and retrieves the response. The class that this comes from was designed to simulate a SOAP request to a server that required certain... quirks that made it impossible to use a standard SOAP client. Yes, the SOAP server was written in .NET; why do you ask?

                [code=php]
                require_once('L B_Curl.class.ph p');
                $curl = new LB_Curl(self::_ URI_SERVER);

                $curl->setOpt(array (
                CURLOPT_HEADER => true,
                CURLOPT_RETURNT RANSFER => true,
                CURLOPT_SSL_VER IFYPEER => 0, // Not supported in PHP
                CURLOPT_SSL_VER IFYHOST => 0, // at this time.
                CURLOPT_HTTPHEA DER => array(
                'User-agent: __MUNGED__/' . self::_VERSION,
                'Host: ' . self::_HOSTNAME ,
                'SOAPAction: ' . self::_SOAPACTI ON . $meth,
                'Content-type: application/soap+xml; charset=utf-8',
                'Content-length: ' . strlen($content ),
                'Connection: Keep-Alive'
                ),
                CURLOPT_POST => true,
                CURLOPT_POSTFIE LDS => $content
                ));

                /***************
                *
                * cURL closes itself when the connection is not persistent.
                */
                $result = $curl->exec();
                [/code]

                And attached you can find a barebones LB_Curl.
                Attached Files

                Comment

                • pbmods
                  Recognized Expert Expert
                  • Apr 2007
                  • 5821

                  #9
                  P.S., $meth is short for 'method'. Really.

                  Comment

                  Working...