Jump to content

Recommended Posts

now I'm new to php, and been teaching myself.

I found online a class to use with php that allows me to pull information from the XML file on our shoutcast server. The problem I ran into is when I uploaded it to my host, I found out they block the use of fsockopen. I've read up on cURL but still can't wrap my head around it...

 

I have some of the class converted to use cURL but I'm running into a problem around this part:

 

        //$fp = fsockopen($this->host, $this->port, $errno, $errstr, 10);
        $fp = $data;
        If (!$fp) {
            $this->_error = "$errstr ($errno)";
            return(0);
        } else {
            fputs($fp, "GET /admin.cgi?pass=".$this->passwd."&mode=viewxml HTTP/1.0\r\n");
            fputs($fp, "User-Agent: Mozilla\r\n\r\n");
            while (!feof($data)) {
                    $this->_xml .= fgets($data, 512);
            }
            fclose($fp);

            if (stristr($this->_xml, "HTTP/1.0 200 OK") == true) {
                // <-H> Thanks to Blaster for this fix.. trim();
                $this->_xml = trim(substr($this->_xml, 42));
            } else {
                $this->_error = "Bad login";
                return(0);
            }

now I had a small workaround that ended up not working.

I kept getting the Bad Login error message.

 

I've searched online for a remedy and well all I could find were posts saying dump the host and find one that allows fsockopen....

 

If anyone can help me I'd greatly appreciate it, this problem is keeping me from finishing off an integration between the database, the webpage, and the dj's.

 

**I have attached the file (both the pure file and the edited file minus passwords and other sensitive information) for you all to look at.

 

***Oops forgot, using PHP5

 

[attachment deleted by admin]

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.