Hi, file_get_content() only returns false (0) if it could not fetch the url (confirm on php.net). Additionally going through line 38- 52 of /web/plugin/gateway/kannel/fn.php of playsms, i cant see any reason why file_get_content() would return '0'.
Please print the output of $ok and $rv. On 10/21/09, Emmanuel CHANSON <emmanuelchan...@gmail.com> wrote: > Yes $rv is equal to '0' when I try to display it so it means that > file_get_contains() return false (I tried without trim() function) > > I will try with curl... > > Regards, > > Emmanuel > > 2009/10/21 Alejandro Guerrieri <alejandro.guerri...@gmail.com> > >> Afaik, no, php yields the warning but I think it should be able to get the >> value on the variable anyway. >> If you want to be absolutely certain you could try porting your code to >> use >> the php curl extension instead. >> >> Regards, >> >> Alejandro >> >> On Wed, Oct 21, 2009 at 10:16 AM, Emmanuel CHANSON < >> emmanuelchan...@gmail.com> wrote: >> >>> Thanks for your answer Alejandro, >>> >>> Maybe then it is the reason why I got nothing in my variable $rv ? >>> Because >>> file_get_contents expect a 200 status instead of 202 ? >>> and then the reason why I always get "Fail to send SMS to" because $ok is >>> always equal to false? >>> >>> Do you have any idea to solve this? >>> -> correct the code of kannel? >>> -> use another function like fsocketopen() ? fputs() ? >>> >>> > if ($rv = trim(file_get_contents("$URL"))) { >>> > // old kannel responsed with Sent. >>> > // new kannel with the other 2 >>> > if (($rv == "Sent.") || ($rv == "0: Accepted for delivery") || >>> ($rv >>> > == "3: Queued for later delivery")) { >>> > $ok = true; >>> > // set pending >>> > $p_status = 0; >>> > setsmsdeliverystatus($smslog_id, $uid, $p_status); >>> > } >>> > } >>> >>> >>> 2009/10/21 Alejandro Guerrieri <alejandro.guerri...@gmail.com> >>> >>> Never used PlaySMS myself, but I can tell you that you can ignore the >>>> warning about the 202 "error". >>>> file_get_contents() throws that warning because it expects a 200 status, >>>> but Kannel yields a 202 (which is "Accepted" instead of "OK", also a >>>> valid >>>> successful header). So it's some kind of php bug in fact. >>>> >>>> Regards, >>>> >>>> Alejandro >>>> >>>> On Wed, Oct 21, 2009 at 3:41 AM, Emmanuel CHANSON < >>>> emmanuelchan...@gmail.com> wrote: >>>> >>>>> I understand, >>>>> >>>>> but because PlaySMS project seems to be died I try to post here if >>>>> anyone had experience with PlaySMS web portal integrated with Kannel. >>>>> >>>>> Regards, >>>>> >>>>> Emmanuel >>>>> >>>>> 2009/10/21 Alvaro Cornejo <cornejo.alv...@gmail.com> >>>>> >>>>> Emanuel >>>>>> >>>>>> This list is for Kannel Support, whatever do playsms we don´t know. >>>>>> >>>>>> Sorry but you might need to check playsms support elsewhere. >>>>>> >>>>>> >>>>>> Regards >>>>>> >>>>>> Alvaro >>>>>> >>>>>> On Tue, Oct 20, 2009 at 7:49 PM, Emmanuel CHANSON >>>>>> <emmanuelchan...@gmail.com> wrote: >>>>>> > Hello again (still bugs with PlaySMS and Kannel) >>>>>> > >>>>>> > In PlaySMS version 0.9.4 when I try to send a SMS using "Send text >>>>>> SMS" I am >>>>>> > getting this error displayed in red on the php page: >>>>>> > >>>>>> > Failed to send SMS to `+XXXXXXX` >>>>>> > >>>>>> > But the SMS is successfully sent to Kannel and fakesmsc receive it: >>>>>> > 2009-10-21 11:29:19 [9778] [0] DEBUG: Got message 7: <+XXXXXX >>>>>> > +XXXXXX >>>>>> text >>>>>> > test - playSMS> >>>>>> > >>>>>> > So after checking the code of PlaySMS in fn.php around line 30 below >>>>>> the >>>>>> > code that should process the return status of the delivery: >>>>>> > >>>>>> > $URL = >>>>>> > "http://localhost:13013/var/www/kannel/sendsms?username= >>>>>> ".urlencode($kannel_param['username'])."&password=".urlencode($kannel_param['password']); >>>>>> > $URL .= >>>>>> > >>>>>> "&from=".urlencode($sms_from)."&to=".urlencode($sms_to)."&text=".urlencode($sms_msg); >>>>>> > $URL .= "&dlr-mask=31&dlr-url=".urlencode($dlr_url); >>>>>> > $URL .= "&mclass=".$msg_type; >>>>>> > >>>>>> > if ($rv = trim(file_get_contents("$URL"))) { >>>>>> > // old kannel responsed with Sent. >>>>>> > // new kannel with the other 2 >>>>>> > if (($rv == "Sent.") || ($rv == "0: Accepted for delivery") >>>>>> || ($rv >>>>>> > == "3: Queued for later delivery")) { >>>>>> > $ok = true; >>>>>> > // set pending >>>>>> > $p_status = 0; >>>>>> > setsmsdeliverystatus($smslog_id, $uid, $p_status); >>>>>> > } >>>>>> > } >>>>>> > >>>>>> > >>>>>> > I find that it is this function that is nok: >>>>>> > $rv = trim(file_get_contents("$URL")); >>>>>> > $rv does not contain anything >>>>>> > but the file_get_contents is executed since the SMS is sent >>>>>> > $URL I catched contains: >>>>>> > >>>>>> > >>>>>> http://localhost:13013/var/www/kannel/sendsms?username=playsms&password=playsms&from=%2B687850850&to=%2B687783548&text=smstest+-+playSMS&dlr-mask=31&dlr-url=http%3A%2F%2F61.5.221.52%2Fplaysms%2Fplugin%2Fgateway%2Fkannel%2Fdlr.php%3Ftype%3D%25d%26slid%3D126%26uid%3D1&mclass=1 >>>>>> > >>>>>> > but the return value of file_get_contains is 0 equal to false right? >>>>>> > >>>>>> > I have also errors in apache: >>>>>> > >>>>>> > [Wed Oct 21 10:11:03 2009] [error] [client 114.69.193.66] PHP >>>>>> Warning: >>>>>> > file_get_contents( >>>>>> http://localhost:13013/var/www/kannel/sendsms?username=playsms&password=playsms&from=%2B687850850&to=%2B687783548&text=smstest+-+playSMS&dlr-mask=31&dlr-url=http%3A%2F%2F61.5.221.52%2Fplaysms%2Fplugin%2Fgateway%2Fkannel%2Fdlr.php%3Ftype%3D%25d%26slid%3D132%26uid%3D1&mclass=1<http://localhost:13013/var/www/kannel/sendsms?username=playsms&password=playsms&from=%2B687850850&to=%2B687783548&text=smstest+-+playSMS&dlr-mask=31&dlr-url=http%3A%2F%2F61.5.221.52%2Fplaysms%2Fplugin%2Fgateway%2Fkannel%2Fdlr.php%3Ftype%3D%25d%26slid%3D132%26uid%3D1&mclass=1> >>>>>> ) >>>>>> > [<a >>>>>> href='function.file-get-contents'>function.file-get-contents</a>]: >>>>>> > failed to open stream: HTTP request failed! HTTP/1.0 202 >>>>>> > Accepted\r\n >>>>>> in >>>>>> > /var/www/playsms/plugin/gateway/kannel/fn.php on line 45, referer: >>>>>> > >>>>>> http://61.5.221.52/playsms/menu.php?inc=send_sms&op=sendsmstopv&message=smstest&err=Failed+to+send+SMS+to+%60%2B687783548%60%3Cbr%3E >>>>>> > >>>>>> > Something is wrong with file_get_contains... >>>>>> > >>>>>> > Although this work using the same URL: >>>>>> > # lynx -dump >>>>>> > " >>>>>> http://localhost:13013/var/www/kannel/sendsms?username=playsms&password=playsms&from=%2B687850850&to=%2B687783548&text=smstest+-+playSMS&dlr-mask=31&dlr-url=http%3A%2F%2F61.5.221.52%2Fplaysms%2Fplugin%2Fgateway%2Fkannel%2Fdlr.php%3Ftype%3D%25d%26slid%3D141%26uid%3D1&mclass=1 >>>>>> " >>>>>> > 0: Accepted for delivery >>>>>> > >>>>>> > Also what do you think of this in the error log? >>>>>> > failed to open stream: HTTP request failed! HTTP/1.0 202 >>>>>> > Accepted\r\n >>>>>> i >>>>>> > >>>>>> > Strange ? >>>>>> > >>>>>> > If this is solved then PlaySMS version 0.9.4 will allow to display >>>>>> the right >>>>>> > status of the SMS delivered or queued or not... >>>>>> > >>>>>> > Regards, >>>>>> > >>>>>> > -- >>>>>> > Emmanuel >>>>>> > >>>>>> > CHANSON Emmanuel >>>>>> > Mobile Nouvelle-Calédonie: +687 850.850 >>>>>> > Mobile France: +33 (0) 6.68.03.89.56 >>>>>> > @email : emmanuelchan...@gmail.com >>>>>> > >>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> >>>>>> |-----------------------------------------------------------------------------------------------------------------| >>>>>> Envíe y Reciba Datos y mensajes de Texto (SMS) hacia y desde cualquier >>>>>> celular y Nextel >>>>>> en el Perú, México y en mas de 180 paises. Use aplicaciones 2 vias via >>>>>> SMS y GPRS online >>>>>> Visitenos en www.perusms.NET www.smsglobal.com.mx y >>>>>> www.pravcom.com >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> Emmanuel >>>>> >>>>> CHANSON Emmanuel >>>>> Mobile Nouvelle-Calédonie: +687 850.850 >>>>> Mobile France: +33 (0) 6.68.03.89.56 >>>>> @email : emmanuelchan...@gmail.com >>>>> >>>> >>>> >>> >>> >>> -- >>> Emmanuel >>> >>> CHANSON Emmanuel >>> Mobile Nouvelle-Calédonie: +687 850.850 >>> Mobile France: +33 (0) 6.68.03.89.56 >>> @email : emmanuelchan...@gmail.com >>> >> >> > > > -- > Emmanuel > > CHANSON Emmanuel > Mobile Nouvelle-Calédonie: +687 850.850 > Mobile France: +33 (0) 6.68.03.89.56 > @email : emmanuelchan...@gmail.com > -- -- Kenny w: www.nuObjects.com Bulk SMS Solutions | Managed Hosting | Enterprise Application Development