That's a PHP issue. PHP expects a 200/Accepted response instead of a
202/Accepted and throws that error.
You can ignore the error puting an "@" before the call:
"@file_get_contents()" or use curl if you want to catch the response
string.
Hope it helps,
Alejandro
On 10/20/07, Raphael Maseko <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have tried using file_get_contents( $url ) of file( $url ) to call kannel
> but I keep ending up with the error:
>
> " [<a href='function.file'>function.file</a>]: failed to open stream:
> Success in /usr/local/apache/xxxx"
>
> I am using PHP Version 5.2.3 on Redhat
>
>
> I used the function below that I found using Google:
>
> function sendSmsMessage($in_phoneNumber, $in_msg)
> {
> $url = '/cgi-bin/sendsms?username=' . CONFIG_KANNEL_USER_NAME
> . '&password=' . CONFIG_KANNEL_PASSWORD
> . '&charset=UCS-2&coding=2'
> . "&to={$in_phoneNumber}"
> . '&text=' . urlencode(iconv('utf-8', 'ucs-2', $in_msg));
>
> $results = file('http://'
> . CONFIG_KANNEL_HOST . ':'
> . CONFIG_KANNEL_PORT . $url);
> }
>
>
>
> -----Original Message-----
> From: Alejandro Guerrieri [mailto:[EMAIL PROTECTED]
> Sent: Thursday, October 18, 2007 5:25 PM
> To: [email protected]
> Subject: Re: Sending Multiple SMS's using PHP script
>
> Why are you redirecting with a header?
>
> Use file_get_contents( $url ) or file( $url ) to call kannel.
>
> Alternatively, use sqlbox and insert a row for each message to send
> (if you pretend to send a high load of messages that's definitely the
> way to go).
>
> Regards,
>
> Alejandro
>
> On 10/18/07, Raphael Maseko <[EMAIL PROTECTED]> wrote:
> >
> > Hi All,
> >
> > I am trying to use kannel to send multiple SMS' with different content
> > retrieved from a database.
> >
> > I have a php script that is accessing a database and retrieving a value
> > corresponding to a mobile number. It is then supposed to send SMS's to the
> > numbers retrieved.
> >
> > What is happening is that it will only send the first one and stop. No
> error
> > is given. I have tried to remove the 'function send_many_sms' and use and
> > include with the 'hearder (location)' but getting the same error. I am
> > calling the php file using lynx.
> >
> > I know that this may not be strictly a kannel issue but I would appreciate
> > pointers. Thanks for your help in advance.
> >
> > Ralph
> >
> > ----------
> >
> >
> >
> >
> > <?php
> >
> > function send_many_sms($to, $message)
> > {
> > ob_start();
> >
> >
> >
> header("Location:http://1.2.3.4:13013/cgi-bin/sendsms?username=username&pass
> > word=password&to=$to&text=$message");
> > ob_get_flush();
> > flush();
> > }
> >
> > if (!$link = mysql_connect('localhost', 'user', '')){echo 'Could not
> > connect to mysql';
> > exit;
> > }
> >
> > if (!mysql_select_db('DBase', $link)) {
> > echo 'Could not select database';
> > exit;
> > }
> >
> >
> > SELECT STATEMENT HERE
> >
> >
> > if (!$result) {
> > echo " DB Error, could not query the Database\n";
> > exit;
> > }
> > else
> > {
> > while ($row = mysql_fetch_assoc($result))
> > {
> > $to=$row['MobileNumber'];
> > $Balance = $row['Value'];
> > $message="Your balance is ".$Balance;
> >
> > send_many_sms($to, $message);
> > }
> >
> >
> > mysql_close($link);
> > }
> >
> >
> >
> >
>
>
> --
> Alejandro Guerrieri
> Magicom
> http://www.magicom-bcn.net/
> LinkedIn: http://www.linkedin.com/in/aguerrieri
>
>
--
Alejandro Guerrieri
Magicom
http://www.magicom-bcn.net/
LinkedIn: http://www.linkedin.com/in/aguerrieri