Sending .JAR files using NowSMS and PHP

Sending .JAR files using NowSMS and PHP SearchSearch
Author Message
Marcelo Muzilli
New member
Username: Muzilli

Post Number: 10
Registered: 03-2004
Posted on Thursday, May 06, 2004 - 03:27 pm:   

Hello,
in this discussion link (http://support.nowsms.com/discus/messages/485/1360.html) you have a good example in PHP to send GIF and JPG files. I tried to send a MID file using this script and it's working. Now I want to know how can I send a .JAR file using the same script.

It's possible?

Have I, only to change the application type and try to send the file or have more changes?

Regards,

Marcelo Muzilli
Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 2511
Registered: 10-2002
Posted on Thursday, May 06, 2004 - 06:27 pm:   

Hi Marcelo,

I'd recommend sending a JAR file through Multimedia WAP Push instead of MMS.

(There is no reason that you could not include a JAR file inside of an MMS message, but some MMS clients do not make it easy to access JAR files from within an MMS message. Go ahead and try it with some of your target handsets though, as my experience was based largely with some of the early Nokia handsets with Java support, and I haven't re-tested recently.)

There is a similar PHP file for sending Multimedia WAP Push in the following thread:

http://support.nowsms.com/discus/messages/12/2276.html

Basically, you just insert another variable into the other script:

/* The MMSWAPPush field tells NowSMS to send this as a multimedia WAP push instead of as an MMS */
$data["MMSWAPPush"] = "\r\n" . "Yes" ;

-bn
Marcelo Muzilli
New member
Username: Muzilli

Post Number: 11
Registered: 03-2004
Posted on Thursday, May 06, 2004 - 08:01 pm:   

Thank you Bryce.

I put the function "PostToHost" to work normally. But why my site is return this error message:

auth: operador:gsm auth: b3BlcmFkb3I6Z3Nt
Fatal error: Maximum execution time of 30 seconds exceeded in c:\program files\apache group\Apache\htdocs\Portal\glips\mms\scripts\filesend.php on line 125

If go to the code, on line 125 is the following function:

$res .= fread($fp,1);

from the following code line in the function:

$res = "";
while(!feof($fp)) {
$res .= fread($fp,1);
}
fclose($fp);

Could you explain me why this happen? Another thing: do I have to inform the IP, port, username and password from my NowSMS site or from my WAP gateway site?

Thanks in advance,

Marcelo Muzilli
Marcelo Muzilli
New member
Username: Muzilli

Post Number: 12
Registered: 03-2004
Posted on Thursday, May 06, 2004 - 08:49 pm:   

Some responses from the questions above:

1. I have to pass the IP, port, username and password from the NowSMS site;
2. I try to send a GIF file to the phone and it works;

The big question is:
The error message was inside the php.ini configuration file, in the variable "max_execution_time". I left it with 480 seconds, and not with 30 (default value).

And why it has a long time to send to my phone?

Marcelo Muzilli
Marcelo Muzilli
New member
Username: Muzilli

Post Number: 13
Registered: 03-2004
Posted on Friday, May 07, 2004 - 02:28 pm:   

Another question:

-> Have I to configure my MMSC VASP page in the NowSMS software to send my JAR file?

Marcelo Muzilli
Marcelo Muzilli
New member
Username: Muzilli

Post Number: 15
Registered: 03-2004
Posted on Friday, May 07, 2004 - 07:24 pm:   

Bryce,
thank you for your attention. I will try to explain my case because something is wrong with the (or my) code.
I saved the "sendmmwappush.php" and I'm working with it. The problem is if I send the any .JAR file (look there is a .JAR attached in this email), because if I send a .GIF file it's works. I don't know what happen because the browse appears to freeze, there is no network traffic, for example. This is a interesting situation because if I exchage the name of my .GIF file to .JAR file (mypicture.gif to mypicture.jar for example), the script will works normally or, the picture will be send to my cell phone and I can open it, but with a .JAR extension. I tried to send another .JAR file and I has the same problem.
If I increase the "max_execution_time" parameter in the PHP.INI to 480 (for example), restart the service, and try again, the script will be work normally too, but the JAR will not be send to the cell phone (I don't know where it was because the answer from the script is "null").
The URL showed in address is: http://localhost/Portal/glips/mms/envia_mms.php?SelectPhone=99433018&MMSFROM=a&MMSSUBJECT=a&MMSTEXT=a&remChars=2499&remLines=80&SendMMS=++Enviar++
The test is running under MS Windows XP (SP1), Apache/1.3.29 (Win 32) with PHP/5.0.0RC2 and NowSMS v5.01 (b20040120).

Regards,

Marcelo Muzilli
_______________________________

From: Bryce Norwood - NowSMS [mailto:nowsms@now.co.uk]
Sent: sexta-feira, 7 de maio de 2004 14:35
To: Marcelo Muzilli (Gelt)
Subject: Re: Sending .JAR files using NowSMS and PHP

Hi Marcelo,

Does the script work properly for other object types, or are you getting this error for all object types?

It sounds like no response is coming back from the server.

The IP address, port, username and password would be the settings for the NowSMS server, so if this is happening for all objects, perhaps that is incorrect.

The settings should be the IP address and port for the web interface of NowSMS. And username and password should be for an account defined in the "SMS Users" list.

-bn

--
Bryce Norwood
Now SMS/MMS Support
nowsms@now.co.uk
http://support.nowsms.com/discus
application/octet-streamcubs.jar
cubs.jar (22.4 k)
Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 2530
Registered: 10-2002
Posted on Friday, May 07, 2004 - 08:30 pm:   

Marcelo,

Hmm.

I tried on my system, sending your JAR file, and it went to my phone without any problem.

I'm using PHP 4.3.6 instead of 5.0.0RC2. But I wouldn't expect that to make a difference. (Although I did have someone recently who was using PHP 4.0, and they had a problem where the "implode" function was stripping null
characters, so some GIF images were being corrupted. So maybe there is some new bug in PHP 5.0.0RC2.)

I am a little confused by one thing in your message:

> The URL showed in address is:
>
http://localhost/Portal/glips/mms/envia_mms.php?SelectPhone=99433018&MMSFROM
> =a&MMSSUBJECT=a&MMSTEXT=a&remChars=2499&remLines=80&SendMMS=++Enviar++
> The test is running under MS Windows XP (SP1), Apache/1.3.29 (Win
> 32) with PHP/5.0.0RC2 and NowSMS v5.01 (b20040120).

What is that URL?

Is that the URL for your PHP script?

What if you just try the original sendmmwappush.php again, but for debugging
purposes, just run it from the command line (\php\php.exe sendmmwappush.php).

Just change the parameters in the file to send your content.

Try renaming your JAR to give it a GIF extension. Does it still give you a problem? If so, then maybe there is a problem like the null characters being stripped in the older version of PHP.

-bn

Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 2531
Registered: 10-2002
Posted on Friday, May 07, 2004 - 08:32 pm:   


quote:

Have I to configure my MMSC VASP page in the NowSMS software to send my JAR file?




No.

The PHP scripts interface in with the NowSMS web interface. They perform functionality similar to the functionality using the web interface of NowSMS. (The MMSC VASP settings relate to MMS specific protocols.)

This does give me an idea however.

Let's back up for a minute.

How about sending your JAR file through the NowSMS web interface. (Try the "Send Multimedia WAP Push Message" function.)

Does that work properly for you?

And you can use the web interface to send a GIF file, right?
Marcelo Muzilli
New member
Username: Muzilli

Post Number: 16
Registered: 03-2004
Posted on Monday, May 10, 2004 - 12:54 pm:   

Thank you Bryce. :-D

It's working with PHP 4.3.6 version. Really, there is a problem with PHP 5.0.0RC2, and it works when I download the previous version.

You have a good idea!!! But, I'm developing a portal and I cannot use the NowSMS web interface. I don't know if it's possible to load the NowSMS classes inside my html form.

The link problem described above refers to an updated version of sendmmwappush.php, that I made it. ;-)

Regards,

Marcelo Muzilli
Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 2567
Registered: 10-2002
Posted on Wednesday, May 12, 2004 - 07:01 pm:   

Hi Marcelo,

I'm glad we were able to track this down to a PHP problem.

I realise that you'll want to use your own web interface ... I was just suggesting that you confirm it is working through our web interface as a troubleshooting step. But, that is a moot point now since it is working!

-bn