Giter VIP home page Giter VIP logo

Comments (16)

andrewscofield avatar andrewscofield commented on September 14, 2024

Sorry I don't have any tutorials up yet! Here is some test code which has a working notification happening. More sample code can be found here:

https://github.com/apotropaic/parse.com-php-library/tree/2.0/master/tests

$parsePush = \Enhance\Core::getCodeCoverageWrapper('parsePush');

//$parsePush->channel = 'TEST_CHANNEL_ONE'; //this or channels required
$parsePush->channels = array('TEST_CHANNEL_ONE','TEST_CHANNEL_TWO'); //this or just channel required
$parsePush->alert = 'Testing Channel 1'; //required

//BELOW SETTINGS ARE OPTIONAL, LOOKUP REST API DOCS HERE: http://parse.com/docs/rest#push FOR MORE INFO
$parsePush->expiration_time = time( strtotime('+3 days') ); //expire 3 day from now
//$parsePush->expiration_time_interval = 86400; //expire in 24 hours from now
$parsePush->type = 'ios';
$parsePush->badge = 538; //ios only
$parsePush->sound = 'cheer'; //ios only
$parsePush->content_available = 1; //ios only - for newsstand applications. Also, changed from content-available to content_available. 
//$parsePush->title = 'test notification title'; //android only - gives title to the notification

//CUSTOM DATA CAN BE SENT VERY EASILY ALONG WITH YOUR NOTIFICATION MESSAGE AND CAN BE ACCESSED PROGRAMATICALLY VIA THE MOBILE DEVICE... JUST DON'T SET NAMES THE SAME AS RESERVERD ONES MENTIONED ABOVE

$parsePush->customData = 'This data will be accessible in the ios and android SDK callback for push notifications';

$return = $parsePush->send();

from parse.com-php-library.

lucasromeiro avatar lucasromeiro commented on September 14, 2024

Hello friend. Thanks for the reply.
I have had many problems, I can not use the codes.
I tried to use what you posted, I tried to use the test.php. But it still fails. = /
whenever an error occurs.
was the last error: Call to undefined method stdClass :: send ()
playing only the code that you gave me.
Look at my code:
'''

channels = array ('*'); $parse -> title = ('Newton'); $parse -> __set('loco','vaca'); //$parse -> send(); Problem HERE in this call !!!!!!!!!!!!!! //-------- //$parsePush = \Enhance\Core::getCodeCoverageWrapper('parsePush'); //$parsePush->channel = 'TEST_CHANNEL_ONE'; //this or channels required $parsePush->channels = array('TEST_CHANNEL_ONE','TEST_CHANNEL_TWO'); //this or just channel required $parsePush->alert = 'Testing Channel 1'; //required //BELOW SETTINGS ARE OPTIONAL, LOOKUP REST API DOCS HERE: http://parse.com/docs/rest#push FOR MORE INFO $parsePush->expiration_time = time( strtotime('+3 days') ); //expire 3 day from now //$parsePush->expiration_time_interval = 86400; //expire in 24 hours from now $parsePush->type = 'ios'; $parsePush->badge = 538; //ios only $parsePush->sound = 'cheer'; //ios only $parsePush->content_available = 1; //ios only - for newsstand applications. Also, changed from content-available to content_available. //$parsePush->title = 'test notification title'; //android only - gives title to the notification //CUSTOM DATA CAN BE SENT VERY EASILY ALONG WITH YOUR NOTIFICATION MESSAGE AND CAN BE ACCESSED PROGRAMATICALLY VIA THE MOBILE DEVICE... JUST DON'T SET NAMES THE SAME AS RESERVERD ONES MENTIONED ABOVE $parsePush->customData = 'This data will be accessible in the ios and android SDK callback for push notifications'; $return = $parsePush->send(); ?> '''

from parse.com-php-library.

lucasromeiro avatar lucasromeiro commented on September 14, 2024

Help me please !!

from parse.com-php-library.

andrewscofield avatar andrewscofield commented on September 14, 2024

You've got WAY to much code in there. Are you trying to JUST send a global notification or to a specific channel? You have a channel array with "*" in it which is not an option. Also, you don't need to include the EnchanceTestFramework.php file.

If you want to send a global notification you can do it very easily by just the following lines

$parsePush = new parsePush( 'Global message to be sent out right away' );

$return = $parsePush->send(); //returns true if successful and error message if not.

If you want to sent to a single channel you would do it this way:

$parsePush = new parsePush();
$parsePush->channel = 'SINGLE_CHANNEL';
$parsePush->alert = 'Message sent to just single channel';

$return = $parsePush->send(); //returns true if successful and error message if not.

If you want to send to multiple channels, its very similar to the single channel, you'd do it like this:

$parsePush = new parsePush();
$parsePush->channels = array('CHANNEL_ONE','CHANNEL_TWO');
$parsePush->alert = 'Message sent to just single channel';

$return = $parsePush->send(); //returns true if successful and error message if not.

from parse.com-php-library.

lucasromeiro avatar lucasromeiro commented on September 14, 2024

Thanks for the reply, I think I'm missing in the library configurations.
I re-download your files 2.0.
after downloading, I need only open the file parse.php and fill in the fields:

private $ _appid =
private $ _masterkey =
private $ _restkey =
private $ _parseurl =

then create a main file and load parse.php and use their command lines above.

Something like this:

$ = new parsePush parsePush ();
$ parsePush-> channel = 'SINGLE_CHANNEL';
$ parsePush-> alert = "Message sent to just single channel ';

$ return = $ parsePush-> send () / / returns true if successful and error message if not.

Correct?
I will download again and do this or am I forgetting to do something or am I doing something wrong?

Thank you for your help!

from parse.com-php-library.

lucasromeiro avatar lucasromeiro commented on September 14, 2024

I change too?

public $ data;
public $ requestURL ='';
public $ returnData ='';

from parse.com-php-library.

andrewscofield avatar andrewscofield commented on September 14, 2024

See this link for getting the config to work:

https://github.com/apotropaic/parse.com-php-library/tree/2.0/master#setup

Also this line doesn't work:

$ = new parsePush parsePush ();

from parse.com-php-library.

lucasromeiro avatar lucasromeiro commented on September 14, 2024

apotropaic, thanks for your help and patience. I'm having trouble.
I did everything as explained in the link above.
But did not work.
I did everything I asked.

My index.php looks like this:

<php
include_once 'parse.php';

parsePush parsePush = new $ ('test Lucas');

$ parsePush-> channel = '*';/ / this or just channel required
$ parsePush-> alert = 'Testing Channel 1' / / required

$ return = $ parsePush-> send () / / returns true if successful and error message if not.
  ?>
Right this way.

I looked at the problem when you call this line: $ return = $ parsePush-> send ();

The error that appears in the browser:

Notice: Trying to get property of non-object in C: \ xampp \ htdocs \ PizzApp \ PizzApp \ parse.php on line 177

Notice: Trying to get property of non-object in C: \ xampp \ htdocs \ PizzApp \ PizzApp \ parse.php on line 177

Fatal error: Uncaught ParseLibraryException: [0]: thrown in C: \ xampp \ htdocs \ PizzApp \ PizzApp \ parse.php on line 170

Line 170: throw new ParseLibraryException ($ msg, $ code);

Line 177: $ this-> throwError ($ error-> error, $ error-> code);

I think I'm getting close to make it work.
I thank very much for your help!

from parse.com-php-library.

andrewscofield avatar andrewscofield commented on September 14, 2024

Hey is that your entire php script? Let me know, so I can rewrite that for
you.
On Aug 3, 2012 7:02 PM, "lucasromeiro" <
[email protected]>
wrote:

apotropaic, thanks for your help and patience. I'm having trouble.
I did everything as explained in the link above.
But did not work.
I did everything I asked.

My index.php looks like this:

<php
include_once 'parse.php';

parsePush parsePush = new $ ('test Lucas');

$ parsePush-> channel = '*';/ / this or just channel required
$ parsePush-> alert = 'Testing Channel 1' / / required

$ return = $ parsePush-> send () / / returns true if successful and error
message if not.
?>
Right this way.

I looked at the problem when you call this line: $ return = $ parsePush->
send ();

The error that appears in the browser:

Notice: Trying to get property of non-object in C: \ xampp \ htdocs
PizzApp \ PizzApp \ parse.php on line 177

Notice: Trying to get property of non-object in C: \ xampp \ htdocs
PizzApp \ PizzApp \ parse.php on line 177

Fatal error: Uncaught ParseLibraryException: [0]: thrown in C: \ xampp
htdocs \ PizzApp \ PizzApp \ parse.php on line 170

Line 170: throw new ParseLibraryException ($ msg, $ code);

Line 177: $ this-> throwError ($ error-> error, $ error-> code);

I think I'm getting close to make it work.
I thank very much for your help!


Reply to this email directly or view it on GitHub:

#26 (comment)

from parse.com-php-library.

lucasromeiro avatar lucasromeiro commented on September 14, 2024

Hello apotropaic, im sorry for bothering you, and yes this is my entire php script..

Im currently trying you library with parse each step at a time, its because im new to php.. all i did so far was create this php file exactly as typed above and run it as the index of my domain. And thats where im getting all these errors... So if you could rewrite it the correct way so i can send a simple broadcast push notification for iOS.. the ios device is working properly, i tested sending the pushes through the Parse Data Browser and it worked like a charm...

Thanks,
Lucas

from parse.com-php-library.

andrewscofield avatar andrewscofield commented on September 14, 2024

ok, your script needs to look like this:

<?php 
require_once 'parse.php';

$push = new parsePush('test global message, Lucas');

$return = $push->send();

print_r($return);

?>

that is it! You seem to continue to make the same php coding error here:

parsePush parsePush = new $ ('test Lucas');

so, to be less confusing I change the $parsePush variable to just $push.

The other options available on the parsePush api are just there if you need to send to specific channel or have other needs during a push notification.

from parse.com-php-library.

lucasromeiro avatar lucasromeiro commented on September 14, 2024

Hello my friend, I did as you told me, but the error I posted above is still happening.
Could you write a simple but complete code that would run? By complete i mean so i will only have to replace the keys.
Thanks

from parse.com-php-library.

andrewscofield avatar andrewscofield commented on September 14, 2024

Hey I found an error on my README file under the config section. I've updated it please make your config file look like it says to here:

https://github.com/apotropaic/parse.com-php-library/tree/2.0/master#setup

from parse.com-php-library.

lucasromeiro avatar lucasromeiro commented on September 14, 2024

hello friend, I had already noticed this problem. I had already corrected it.
Then I pu the problem lies elsewhere. still gives the same error showed up.
You could do a simple code that works to make a push notification? and I just change the keys?
here only for testing.

Also note that the lines are giving parse.php error here:

    $this->_appid = $parseConfig::APPID;
    $this->_masterkey = $parseConfig::MASTERKEY;
    $this->_restkey = $parseConfig::RESTKEY;
    $this->_parseurl = $parseConfig::PARSEURL;

Thank you for your help.

from parse.com-php-library.

kjj1 avatar kjj1 commented on September 14, 2024

Hi apotropaic,
and thanks for your library.

I'm having a (supposedly) very basic issue with your library (both version 1 and 2).
I just want to query all objects of the class ("Repairer" in parse.com data browser) and, after initializing lie this :

require ("parse/parse.php");
$parse = new parseRestClient(array(
'appid' => 'xxxxxxxxxxxxxxxxxxxxxxxx',
'restkey' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx'
));

(with the correct keys of course; also, the parseConfig.php is correctly filled)

I just call a simple function to retrieve them :


function getRepairers() {
$query = new parseQuery('repairers');
$query->where('status', 0);
$request = $query->find();
return $request;

}

I get this notice (that I had in version 1 too) :

Notice: Trying to get property of non-object in E:\xampp\htdocs\parse\parse\parse.php on line 162

twice, and then this one :

Fatal error: Uncaught ParseLibraryException: [0]: thrown in E:\xampp\htdocs\parse\parse\parse.php on line 155


Apparently, the expected (HTTP) code is 200, but the received one is 0 (which is not a HTTP code as far as I know).
I understand I am missing something very basic, can you please tell me what ?

Thanks in advance

from parse.com-php-library.

andrewscofield avatar andrewscofield commented on September 14, 2024

Hey, this is a closed issue you commented on. Would you mind opening one of your own while I look into this? Thanks!

from parse.com-php-library.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.