Send Sms In Yii Using Gsm Modem

I’ve tried out using this code, but it gives me SOCKET ERROR. Any idea what might have caused it?

Windows 7 Ultimate, XAMPP, Yii 1.1.x, Intel Atom, 2GB ram

I think its on this part of the code.


public function deviceOpen()

    {

        $this->_socket = @fsockopen($this->_host, $this->_port, $errno, $errstr, 30);


        if (!$this->_socket) {

			echo $errno . " " .$errstr;

			echo "Socket: " . $this->_socket;

			echo !$this->_socket;

            throw new Exception("SOCKET ERROR");

        } else {

            socket_set_timeout ($this->_socket, 10);

        }

    }



Thanks.

Have you tried without error suppression (removing the @)?

Have you tried without _host and _port attributes, directly with a string and an int?

Hi bennouna, thank you for the fast response.

I’ve tried removing the @, the program gave me a better detail of the error.


Warning: fsockopen() [function.fsockopen]: unable to connect to 192.168.1.10:1113 (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ) in C:\xampp\htdocs\sms_notification\Sms\Http.php on line 36

10060 A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. Socket: 1SOCKET ERROR

And as for the _host and _port, sorry but I have no idea on how to make it directly to a string and an int. Can you tell me how to do it?

Yh

I’ve tried removing the @, the program gave me a better detail of the error.


Warning: fsockopen() [function.fsockopen]: unable to connect to 192.168.1.10:1113 (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ) in C:\xampp\htdocs\sms_notification\Sms\Http.php on line 36

10060 A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. Socket: 1SOCKET ERROR

And as for the _host and _port attributes, sorry but I have no idea on how to convert it into a string and an int. Can you tell me how to do it?

Thanks.

I just wanted to make sure that you had correct input values, but it appears you have (192.168.1.10:1113)

Now your error is clear imo. It’s not related to Yii or PHP thing I guess, but a network issue.

Well, I’ve given up on using that code. Now I’ve discovered something new which is an extension of Yii Framework. It is called ClickaTell and I’m trying to work on it now.

Thanks for the advice though.