How to execute the PHP scripts given for MMS and WAP Push sending m...

How to execute the PHP scripts given for MMS and WAP Push sending m... SearchSearch
Author Message
Beemabi Husaina
New member
Username: Beemabi

Post Number: 6
Registered: 05-2004
Posted on Thursday, June 17, 2004 - 01:07 pm:   

I had seen the discussion in page

http://support.nowsms.com/discus/messages/12/2276.h tml
for sending WAP Push messages and

http://support.nowsms.com/discus/messages/1/1113.ht ml for sending MMS.

But i need to know how we will be executing the .php file because the code is in function format.Is it possible to send WAP push messages and MMS from command line interface.How will this PHP script be used for it.

Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 2865
Registered: 10-2002
Posted on Thursday, June 17, 2004 - 08:27 pm:   

Hi,

That's a good question.

Basically, those script examples that you reference can be run directly from the command line.

There is a function in the file, but there is also mainline code that calls the function and sets up parameters that are passed to the function.

In these particular scripts, you would need to edit the filename references, as well as the host name and account settings.

Then you just run:

php.exe d:\path\scriptname.php

And the script will be executed.

An interesting enhancement to the scripts referenced above would be to convert them so that they would accept parameters so that parameters could be passed via the command line instead of having to be hardcoded into the script. Perhaps when I get some extra time, I will look at doing this.

-bn
Beemabi Husaina
New member
Username: Beemabi

Post Number: 7
Registered: 05-2004
Posted on Monday, June 21, 2004 - 05:07 am:   

Hai Bryce,

It is nice to see that directly we need to give the command from command line.When i tried that, I get an error saying
-->'php.exe' is not recognized as an internal or external command,operable program or batch file.

Is there any additional software that i need to install?Awaiting your response.

-Beemabi Husaina
Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 2874
Registered: 10-2002
Posted on Tuesday, June 22, 2004 - 06:01 pm:   

Yes, you need PHP in order to run a PHP script.

You can download it from http://www.php.net/downloads.php.

At the present time, I advise downloading the v4.3.x version, and avoid the v5.0 release candidate version because of bugs in the "implode" function that is used by some of our scripts.
Beemabi Husaina
New member
Username: Beemabi

Post Number: 8
Registered: 05-2004
Posted on Tuesday, June 29, 2004 - 11:37 am:   

Hai Bryce,

I am actually trying to develop equivalent java code for the SMS,MMS and WapPush PHP scripts mentioned in http://www.nowsms.com/framer.htm?1.http://support.nowsms.com/discus/messages/1/867.h tml
2.http://support.nowsms.com/discus/messages/1/1113. html
3.http://support.nowsms.com/discus/messages/12/2276 .html. It would be helpful if you could give me the explanation for the MMS PHP script.The usage of @file($file1) and $val is not clear.

Regards,
A.H.K.Beemabi Husaina
Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 2938
Registered: 10-2002
Posted on Tuesday, June 29, 2004 - 09:47 pm:   

The PHP script is basically building an HTTP request of the format described at the following link:

http://www.nowsms.com/documentation/ProductDocumentation/mms_notifications_and_c ontent/Submitting_MMS_Messages_URL.htm

So, basically we are importing the content of the file into the post.

Someone did a Java equivalent which might help you. It is at the following link:

http://support.nowsms.com/discus/messages/485/1360.html

Beemabi Husaina
New member
Username: Beemabi

Post Number: 9
Registered: 05-2004
Posted on Wednesday, June 30, 2004 - 06:21 am:   

Hai Bryce,

Thanks for the code.It seems to work in apache environment.Can't it be done without an apache environment?

Regards,
A.H.K.Beemabi Husaina
Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 2946
Registered: 10-2002
Posted on Wednesday, June 30, 2004 - 05:45 pm:   

I don't know enough about Java to answer that.

Basically, when you submit a web form that includes a file upload component, the standard is to post the form using the MIME type of "multipart/form-data".

I don't think any of the standard Java classes provide any aid in formatting this type of HTTP request.

The Apache HttpClient has built-in support for building HTTP requests using the "multpart/form-data" MIME type.

It doesn't require that you are using the Apache web server ... it is a separate Apache project, where basically you can download the classes and add them to your Java install. Here are the relevant links:

http://jakarta.apache.org/commons/httpclient/index.html
http://jakarta.apache.org/commons/httpclient/downloads.html
http://jakarta.apache.org/commons/httpclient/tutorial.html
Beemabi Husaina
New member
Username: Beemabi

Post Number: 10
Registered: 05-2004
Posted on Thursday, July 01, 2004 - 09:53 am:   

Hai Bryce,

In the PHP script of MMS,the file to be embedded as MMS say a .gif file location is specified as "C:\TEMP\logo.gif".Before sending the MMS does it mean that the .gif must be placed in a TEMP folder or will it be created automatically at the time of sending MMS.

I am asking the question because in the place of file location ,i tried giving the absolute path of the file to be embedded and saw a TEMP directory created in C: automatically.Is it enough to specify the file path alone or the file data also needs to be passed to the recipient.

Regards,
A.H.K.Beemabi Husaina
Beemabi Husaina
New member
Username: Beemabi

Post Number: 11
Registered: 05-2004
Posted on Monday, July 05, 2004 - 07:48 am:   

Hai Bryce,

I got the MMS java code for sending MMS.It can be enhanced for perfoming WAP Push.But a query i have is that in WAP Push there are categories like Service Indication(SI),Service Loading(SL) and Cache Operation(CO). There seems to be no option in the PHP script provided for WAP PUSH for such categories.It would be helpful if you could guide me in this matter.

Regards,
A.H.K.Beemabi Husaina
Beemabi Husaina
New member
Username: Beemabi

Post Number: 12
Registered: 05-2004
Posted on Monday, July 05, 2004 - 11:47 am:   

Hai Bryce,

You had given me the idea of URL submission for MMS messages as provided in the link

http://www.nowsms.com/documentation/ProductDocumentation/mms_notifications_and_c ontent/Submitting_MMS_Messages_URL.htm

Can you specify me the format of submission in the case os WAP Push too?It would be very helpful.

Regards,
A.H.K.Beemabi Husaina
Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 2992
Registered: 10-2002
Posted on Wednesday, July 07, 2004 - 08:39 pm:   


quote:

In the PHP script of MMS,the file to be embedded as MMS say a .gif file location is specified as "C:\TEMP\logo.gif".Before sending the MMS does it mean that the .gif must be placed in a TEMP folder or will it be created automatically at the time of sending MMS.




It means that the file must be physically present there.

If you want to send referencing an object by HTTP URL instead of a local file, then it is actually possible to generate an HTTP GET request instead of a POST. There is an example at the bottom of the following page:

http://www.nowsms.com/documentation/ProductDocumentation/mms_notifications_and_c ontent/Submitting_MMS_Messages_URL.htm


quote:

I got the MMS java code for sending MMS.It can be enhanced for perfoming WAP Push.But a query i have is that in WAP Push there are categories like Service Indication(SI),Service Loading(SL) and Cache Operation(CO). There seems to be no option in the PHP script provided for WAP PUSH for such categories.It would be helpful if you could guide me in this matter.




If you want to have NowSMS host the content, and send it out as a Multimedia WAP Push (SI push, but NowSMS hosts the content), then simply insert the variable MMSWapPush=Yes into the submission.

For simple SI or SL push requests, you can generate HTTP requests:

http://www.nowsms.com/documentation/ProductDocumentation/sending_messages/sendin g_wap_push_messages.htm

There are also some additional parameters that can be specified for SI and SL push, but they are not included in the documentation. They are documented here, and you will also see them in our web forms for sending push messages:

http://support.nowsms.com/discus/messages/485/3834.html
http://support.nowsms.com/discus/messages/53/279.html

You can also create your own <si> or <sl> XML document, and submit it via the "Send XML Settings" page in the web interface, or programatically such a document can be submitted through the PAP (Push Access Protocol) interface. There is an SI example posting via PAP at the following link:

http://support.nowsms.com/discus/messages/485/3293.html

We haven't done anything for CO (cache operations). But, this is something we should add. If you need it, I could probably send you an update that includes support for the "<co>" documents (text/vnd.wap.co) within a week or so.

-bn