Giter Club home page Giter Club logo

parse.com-php-library's People

Contributors

alexargo avatar andrewscofield avatar daspecster avatar desarrolla2 avatar ericoe avatar hoseking avatar jontonsoup avatar kasperpihl avatar martindavis avatar theboardsaredown avatar warnew avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

parse.com-php-library's Issues

How to query?

I want to test this version, but I get an error on the parseClient is missing "Class 'parseRestClient' not found"

Can you give us a working example how to use the whole new parse php library

cheers Fred

Login

Thanks for a great API !

Is it possible to send a query to https://api.parse.com/1/login to get username and password ?

I get the following error back when trying:
ERROR: response code was 400 with message: missing user password

I tried with 'password' => urlencode($password) with no success.

parseObject suggestion


       public function __get($name) {
                if($name != '_className'){
                        return $this->data[$name];
                }
                return NULL;
        }

whereRegex shoots out a bad special key error

Hey,

Seems like there's a slight issue with the whereRegex function.

It always passes $options=' ' and Parse shoots out this error:
"Uncaught ParseLibraryException: [102]: parse.com error: bad special key: options "

If I comment out the 'options' => $options part it seems to work (I guess Parse doesn't like empty values there if you pass it).

Maybe this should be like this instead (there's probably a better way :) -

public function whereRegex($key,$value,$options){
if(isset($key) && isset($value)){
$this->_query[$key] = array(
'$regex' => $value,
if (isset($options)) {
'options' => $options
}
);
}
else{
$this->throwError('the $key and $value parameters must be set when setting a "where" query method');
}

Upload a file for a new object/update object

How can I upload a image while I make a new Object? I see that the image column is updated but the file is Acces Denied?

Is there somebody that have done this and want to share some example code?

//File must contain only name, url and __type properties
                    //$parse->image = array("__type" => "File", "name" => $_FILES['cImage']['name'], 'url' => 'http://url.com/images/musea/'.$_FILES['cImage']['name']);

                    //$parse = new parseFile();
                    //$filename = 'http://url.com/images/musea/'.$_FILES['cImage']['name'];

                    //$parse = new parseFile('Locations');
                    //$file = parseFile('image/jpeg', file_get_contents($filename));
                    //$parse->image = $file->save('testimage.jpg'); //should return url and name

add/remove relations

Hi apotropaic,
Thanks for the new version. I like the interface much better.
Is there code in there to relate objects? I don't think I see it but I could be missing it.
Thanks,
-jim

Get the user information from the creator behind a post

Hi, i'm currently working on a mobile application that has enabled sharing on facebook.

When i'm on facebook and clicks on a shared post from the mobile application i get to a link containing a specific objectId that retrieves the posts information. The information contains pictures, texts and so on.

In my php script on the webpage i use the method get like this:

$params = array( 'className' => 'Feed', 'objectId' => $_GET['id'] );
$request = $parse->get($params);
$result = json_decode($request);

So far so good, but what if i want to include the user information of the user that created this post? That information is stored in another table called 'User'. I have struggled with this for a long time.

If someone can give me a lead on what to do i would be greatful :)

Thanks alot.

Test for parseQuery->whereInQuery returns bad $inQuery

{"code":102,"error":"bad type for $inQuery"}Array
(
[method] => GET
[requestUrl] => classes/test
[urlParams] => Array
(
[where] => {"object1":{"$inQuery":"{"where":{"name":{"$exists":true}}}","className":"test"}}
[limit] => 100
)

)

Fatal error: Uncaught ParseLibraryException: [102]: parse.com error: bad type for $inQuery

Problems running query comparing to createdAt date

I am trying a query composed of a geo point and comparing date but the results seems that it is ignoring the date part of the where. Is it correct the way the query is performed?

Could you provide some samples comparing against dates using query contraints like: $gte, $in, etc.

Here my code snippet:

$params = array(
'className' => 'xx',
'query' => array(
'geo' => array(
'$nearSphere' => array(
'__type'=> 'GeoPoint', 'latitude' => 25.727409, 'longitude' => -80.306389),
'$maxDistanceInKilometers' => 1)),
//where
'createdAt'=> array(
'$gte' => '2012-04-24T01:02:52.249Z'),
'order' => 'bizName',
'limit' => 10);
$request = $parse->query($params);

Thanks

object counting

The REST API supports object counting, but that seems to be missing from your implementation. I made a couple of additions to my copy of the class which seems to have successfully implemented the feature.

on line 58:

if(isset($args['count'])){
$postData['count'] = $args['count'];
}

and one line 164:

if(isset($args['count'])){
$params['count'] = $args['count'];
}

This allows you to count all objects in a class with params:

$params = array(
'className' => 'ClassName',
'limit' => 0,
'count' => 1
);
$request = $parse->query($params);

Or alternatively count rows matching a query:

$params = array(
'className' => 'ClassName',
'query' => array(
'TextField' => 'TextValue'
),
'limit' => 0,
'count' => 1
);
$request = $parse->query($params);

Relational Query Example no longer valid

I'm assuming this is probably due to some recent changes in the api, but it seems that the example you have posted in the README.md is no longer correct. It should look something more like this:

$params = array(
    'className' => 'User',
    'query' => array(
        'Post' => array(
            '__type' => 'Pointer',
            'className' => 'Post',
            'objectId' => $postId
        )
    )
);

$request = $parse->query($params);

Suggestions and Notes for v2.0

Thanks for the great library! Some suggestions.

  • setLimit function for Query should allow values of 1 and 1000. Should change comparison operators to equals-than or greater than.
  • setStep function needed for Query.
  • count function needed for Query to get total count of objects without returning them.
  • The parse date data type should be converted to a PHP data type with the propoer time zone.
  • The CURL timeout should be changed from 5 seconds to something larger like 30 seconds.

Syntax errors: parseQuery.php

PHP Parse error: syntax error, unexpected '}' in Downloads/apotropaic-parse.com-php-library-4b2e2ee/parseQuery.php on line 48

Fix:

                                $urlParams['count'] = '1';

PHP Parse error: syntax error, unexpected T_DOUBLE_ARROW in Downloads/apotropaic-parse.com-php-library-4b2e2ee/parseQuery.php on line 67
Fix:

                if ($int >= 1 && $int <= 1000){

Neither the test file is working..

I tried to copy and past the test file with the following code:

$testUser = new parseUser;
$testUser->username = "stefano_php";
$testUser->password = "pippo";
$user = $testUser->signup();

This is what I get as response..

Notice: Trying to get property of non-object in D:\EasyPHP-12.1\www\jamyourself\lib.parse.php\parse.php on line 174

Notice: Trying to get property of non-object in D:\EasyPHP-12.1\www\jamyourself\lib.parse.php\parse.php on line 174

Fatal error: Uncaught ParseLibraryException: [0]: thrown in D:\EasyPHP-12.1\www\jamyourself\lib.parse.php\parse.php on line 167

I can't use this library at all, any suggestion on how to fix this stuff? Or is anyone guessing what am I doing wrong???

Unable to get child objects

I'm not able to get child objects by setting the include array before calling parseObject->get(). It does not look like this variable is being passed to the Parse API.

Bug in parseQuery.

Not sure if this was just a recent API change Parse.com's end that hasn't made it over yet, but on line #30 in parseQuery.php the 'query' key in the 'urlParams' array should be 'where'.

how to pass config parameters to class?

we have separate applications defined in Parse for our staging and development environments. in V1 of this library, we could pass the configuration paramaters when instantiating the parseRestClient class. This feature appears to be removed from V2 in favor of a configuration file.

Any suggestions?

How to display results?

Hi,

Want to use this for my backend, iOS I get, but can somebody give me an example how to use this if I want to give a result in a table (divs)... is it json what I get if I use this code:


require_once('parse.php');

$parseQuery = new parseQuery('Locations');
//$parseQuery->where('STAT',1);
//$parseQuery->orderByDescending('TIME');

$parseQuery->setLimit(2);
$response3 = $parseQuery->find();

?>

So how I handle the $respons3 in a real world example to display the result to a user?

Query using geopoints returns bogus results

I am using the recent lib and executing a simple query using geo points. The returns are points that are thousands of miles apart very far from the search points. Any ideas on this? This is the code.

$parse = new parseRestClient(array(
'appid' => 'xxx',
'restkey' => 'xxx'
));

$params = array(
'className' => 'xxx',
'geo' => array(
'$nearSphere' => array(
'__type'=> 'GeoPoint', 'latitude' => 43.3529, 'longitude' => 11.073, '$maxDistanceInKilometers' => '10')),
'order' => 'business_name',
'limit' => '100');
$request = $parse->query($params);
echo $request;

thanks

Creation of new object not working

When running this :

$query = ($_POST['query']) ? $_POST['query'] : $_GET['query'];

$params = array(
    'className' => 'temperature',
    'object' => array(
        'value' => $query

    )
);

$request = $parse->create($params);

I get this warning:

Warning: json_encode() expects exactly 1 parameter, 2 given in /home/corocco/public_html/parse.php on line 134
failed to get response 201, response code was: 400

and no new objects are created..

Any ideas?

Hi, apotropaic

Hi, i would like to make a user login form in PHP to post images, videos and files for specific users, can you provide more info about new methods to be used to accomplish these tasks? Are there any more advance examples to have a friendly user interface for the parse REST API?

Best Regards.

getCount is missing Limit = 0

If you are limiting your query, or if there are a very large number of results, and you want to know how many total results there are without returning them all, you can use the count parameter. For example, if you only care about the number of games played by a particular player:


curl -X GET \
  -H "X-Parse-Application-Id: ucucfdUq3EpDau0cOTPGDl5EKepBYmLlJpNoXKdo" \
  -H "X-Parse-REST-API-Key: sysqIYFSGV6KzCczu1amCs3iTWnukJC8vGu0Li9r" \
  -G \
  --data-urlencode 'where={"playerName":"Jonathan Walsh"}' \
  --data-urlencode 'count=1' \
  --data-urlencode 'limit=0' \
  https://api.parse.com/1/classes/GameScore

Adding a setLimit(0) is not possible, but if you want to make a dashboard it's very slow, because the reason above says it's also getting all the data...

ERROR: response code was 401 with message: unauthorized

I have updated to latest version and started receiving the mentioned error. The reason for it is that following option was eliminated from request function.

curl_setopt($c, CURLOPT_USERPWD, $this->appid . ':' . $this->restkey);

I can see that the intention is to pass these in the header:

curl_setopt($c, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'X-Parse-Application-Id: '.$this->appid,
'X-Parse-REST-API-Key: '.$this->restkey
));

Is this working for anyone? And if yes any pointers why it might not be working on my side?

thanks

failed to get response

failed to get response 201, response code was: 0

or

failed to get response 200, response code was: 0

are the errors I get?

User, Product Classes returning nothing.

I don't know if this is happening to everyone or just me, but I am having trouble getting results back from the User class. It always returns nothing.

$query = new parseQuery("Email");
$query->where('serialized_data',$_GET['id']);
$result = $query->find();
print_r($result); // returns proper result

$query_user = new parseQuery("User");
$query_user->where('objectId',"kHnpx7lBmF");
print_r($query_user->find()); // returns nothing. Should return the User

I've checked the objectId 10 times, the information is correct.
the User Class doesn't have any ACL on it either.

Is there something i'm missing?

Exceptions instead of die

Hi apotropaic, when you're writing the new version, can you use exceptions? I'd rather catch an exception, rather than have the program die.

parseUser suggestion for reset password throught parse mail

It coudl be nice if you can ask for password reset usign this library..
I've added this code at your userParse.php:

public function requestPasswordReset($email){
    if(!empty($email)){
        $request = $this->request(array(
                'method' => 'POST',
                'requestUrl' => 'requestPasswordReset',
                'email' => $email,
                'data' => $this->data
        ));

        return $request;
    }
    else{
        $this->throwError('email is required for the requestPasswordReset method');
    }

}

This way it throws a Parse: ParseLibraryException: [107]: parse.com error: invalid json: null
But the Parse response is a null json if it's all correct... I think this will create a bit of confusion..

Can you help me to make it works in your library?

Performing create using Ints

Does this API support using ints? For example, submitting a number to a Parse class with an int column.

When I use the create API, it will eventually call the request function and perform a json_encode on the payload. This causes the variable to equal something like this:

{"idNumberOne":"Clol67k","intColumnA":"12","intColumnB":"5","stringColumn":"90"}

I'm seeing ERROR: response code was 400 with message: invalid type for key intColumnA, expected number, but got string

I believe what is happening is it's interpreting the quotes. The $postData should look something like:

{"idNumberOne":"Clol67k","intColumnA":12,"intColumnB":5,"stringColumn":"90"} <----- No quotes around the numbers

Being that we are using json_encode this is going to be a difficult problem to solve.... Any suggestions?

Also, I added login and register functionality to the API. Should I push something to somewhere? :D

  • Vin

Roles

Hi!
Your lib is really helpful. Thank you for your work :)

But I have a question:
Can your lib work with roles?

Added query include for multiple query

<?php
class parseRestClient{

    private $appid = '';
    private $restkey = '';
    private $parseUrl = 'https://api.parse.com/1/classes/';


/**
 * When creating a new parseRestClient object
 * send array with 'restkey' and 'appid'
 * 
 */
    public function __construct($config){
        if(isset($config['appid']) && isset($config['restkey'])){
            $this->appid = $config['appid'];
            $this->restkey = $config['restkey'];            
        }
        else{
            die('You must include your Application Id and REST Key');
        }
    }

/*
 * All requests go through this function
 * There are functions that filter all the different request types
 * No need to use this function directly  
 * 
 */ 
    private function request($args){
        $c = curl_init();
        curl_setopt($c, CURLOPT_TIMEOUT, 5);
        curl_setopt($c, CURLOPT_USERAGENT, 'parseRestClient/1.0');
        curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($c, CURLOPT_HTTPHEADER, array(
            'Content-Type: application/json',
            'X-Parse-Application-Id: '.$this->appid,
            'X-Parse-REST-API-Key: '.$this->restkey
        ));
        curl_setopt($c, CURLOPT_CUSTOMREQUEST, $args['method']);
        curl_setopt($c, CURLOPT_URL, $this->parseUrl . $args['url']);

        if($args['method'] == 'PUT' || $args['method'] == "POST"){
            $postData = json_encode($args['payload']);
            curl_setopt($c, CURLOPT_POSTFIELDS, $postData );
        }
        else{
            $postData = array();
            if(isset($args['query'])){
                $postData['where'] = json_encode( $args['query'] );
            }
            if(isset($args['include'])){
                $postData['include'] = $args['include'];
            }
            if(isset($args['order'])){
                $postData['order'] = $args['order'];
            }
            if(isset($args['limit'])){
                $postData['limit'] = $args['limit'];
            }
            if(isset($args['skip'])){
                $postData['skip'] = $args['skip'];
            }
            if(count($postData) > 0){
                $query = http_build_query($postData, '', '&');
                curl_setopt($c, CURLOPT_URL, $this->parseUrl . $args['url'].'?'.$query);
            }

        }

        $response = curl_exec($c);
        $httpCode = curl_getinfo($c, CURLINFO_HTTP_CODE);

        return array('code'=>$httpCode, 'response'=>$response);



    }


    public function create($args){
        $params = array(
            'url' => $args['className'],
            'method' => 'POST',
            'payload' => $args['object']
        );

        $return = $this->request($params);

        return $this->checkResponse($return,'201');

    }   

/*
 * Used to get a parse.com object  
 * 
 * @param array $args - argument hash:
 * 
 * className: string of className
 * objectId: (optional) the objectId of the object you want to update. If none, will return multiple objects from className
 * 
 * @return string $return
 * 
 */
    public function get($args){
        $params = array(
            'url' => $args['className'].'/'.$args['objectId'],
            'method' => 'GET'
        );

        $return = $this->request($params);

        return $this->checkResponse($return,'200');
    }   

/*
 * Used to update a parse.com object  
 * 
 * @param array $args - argument hash:
 * 
 * className: string of className
 * objectId: the objectId of the object you want to update
 * object: object to update in place of old one  
 * 
 * @return string $return
 * 
 */
    public function update($args){
        $params = array(
            'url' => $args['className'].'/'.$args['objectId'],
            'method' => 'PUT',
            'payload' => $args['object']
        );

        $return = $this->request($params);

        return $this->checkResponse($return,'200');
    }

/*
 * Used to query parse.com.  
 * 
 * @param array $args - argument hash:
 * 
 * className: string of className
 * query: array containing query. See: https://www.parse.com/docs/rest#data-querying 
 * order: (optional) used to sort by the field name. use a minus (-) before field name to reverse sort
 * limit: (optional) limit number of results
 * skip:  (optional) used to paginate results
 * include: (optional) return multiple types of related objects in one query See: http://parse.com/docs/rest#queries-relational 
 *
 * @return string $return
 * 
 */

    public function query($args){
        $params = array(
            'url' => $args['className'],
            'method' => 'GET'
        );

        if(isset($args['query'])){
            $params['query'] = $args['query'];
        }
        if(isset($args['include'])){
            $params['include'] = $args['include'];
        }
        if(isset($args['order'])){
            $params['order'] = $args['order'];
        }
        if(isset($args['limit'])){
            $params['limit'] = $args['limit'];
        }
        if(isset($args['skip'])){
            $params['skip'] = $args['skip'];
        }

        $return = $this->request($params);

        return $this->checkResponse($return,'200');

    }

/*
 * Used to get a parse.com object  
 * 
 * @param array $args - argument hash:
 * 
 * className: string of className
 * objectId: (optional) the objectId of the object you want to update. If none, will return multiple objects from className
 * 
 * @return string $return
 * 
 */
    public function delete($args){
        $params = array(
            'url' => $args['className'].'/'.$args['objectId'],
            'method' => 'DELETE'
        );

        $return = $this->request($params);

        return $this->checkResponse($return,'200');
    }   


/*
 * Checks for correct/expected response code.
 * 
 * @param array $return, string $code 
 * 
 * @return string $return['response]
 * 
 */
    private function checkResponse($return,$code){
        //TODO: Need to also check for response for a correct result from parse.com
        if($return['code'] != $code){
            $error = json_decode($return['response']);
            die('ERROR: response code was '.$return['code'].' with message: '.$error->error);
        }
        else{
            return $return['response'];
        }
    }
}

?>

How can I update a specific object

Hi,

This might seem like a stupid question but I couldn't figure out how to update a specific object.

I know the following doesn't work because it calls to a class instead of a specific object within a class (and POST instead of PUT) but I have no idea what to change in order to make it work:

$o = $_POST["objectId"];
$odoValue = intval($_POST["Value"]);

$parseObject = new parseObject('Cars');

$parseObject->VALUE = $Value;
$response = $parseObject->save();

What I'm trying to figure out is how to update the Field 'VALUE' for a specific objectId within the Class Cars.

Thanks in advance! Any help would be appreciated.

Trying to get property of non-object error

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

HELP ME

Hello, I'm having a hard time using the 2.0 library, I am new to PHP, I believe I'm on the right track, but I need help.
this error has occurred:

Uncaught ParseLibraryException

Would make me an example of how to make a push notification? for example?
Or some tutorial?

Since I already am very grateful for the help!!

Where do I begin?

I need a simple script that can send Wordpress posts to a Parse database. My usual PHP guy has disappeared on me and I need this done ASAP. Is there a tutorial or sample file I could look at? Or perhaps you could recommend someone I could hire?

Failed to get response 201 when trying to create an object with GeoPoint

Hello
$parse = new parseRestClient(array('appid' => 'xxx, 'masterkey' => 'xxx'));

I am receiving the error in title. Here is the code.

$params = array(
'className' => 'class_name',
'object' => array(
'geo' => array('__type' => 'GeoPoint', 'latitude' => '43.35', 'longitude' => '11.0'),
'name' => 'my house'));

$request = $parse->create($params);

Can anyone help me with this? It works well if i remove the geo key.

thanks

ldj

Limit=1 problem

Hey,

When I try to query using limit=1 the code just doesn't seem to work (throws an exception).

This works perfectly:

$parseQuery = new parseQuery('CLASS');
$parseQuery->where('STAT',1);
$parseQuery->orderByDescending('TIME');
$parseQuery->setLimit(2);
$response3 = $parseQuery->find();

While this is returning an exception (notice setLimit=1):

$parseQuery = new parseQuery('CLASS');
$parseQuery->where('STAT',1);
$parseQuery->orderByDescending('TIME');
$parseQuery->setLimit(1);
$response3 = $parseQuery->find();

Fatal error: Uncaught ParseLibraryException: [0]: parse requires the limit parameter be between 1 and 1000 thrown in /Applications/MAMP/htdocs//parse/parse.php on line 168

Ideas?

add/remove relations

I added a function called relate to add or remove a relation to your code. Not that good at github, so here is the function:

/**
 *
 * Used to add or remove a relation to a parse.com object
 *
 * @param array $args - argument hash:
 *
 * className: string of className
 * objectId: the objectId of the object you want to update
 * add: boolean
 * columnName: the column name of the relation
 * relationClassName: the classname of the relation you want to add
 * relationObjectId: the objectId of the related object
 */
       public function relate($args){
                $params = array(
                        'url' => $args['className'].'/'.$args['objectId'],
                        'method' => 'PUT'
                );

                $objects = array(
                        "__type" => "Pointer",
                        "className" => $args['relationClassName'],
                        "objectId" => $args['relationObjectId']
                );

                $relation = array(
                        $args['columnName'] => array(
                                                "__op" =>
                                                ($args['add'] ? "Add" : "Remove") . "Relation",
                                                "objects" => array($objects)
                                        )
                );


                $params['payload'] = $relation;

                $return = $this->request($params);

                return $this->checkResponse($return,'200');
        }

how to get relations

hi,

in this library there is no option to get relations.

can you help me about this.

Thanks,
Shahid

localhost

hi Great api by the way version 1 and version 2 i could not work it in my localhost im using xampp 1.7.7 5.3.8 php

can i ask for help thanks

update user without session token

You should be able to update a user without a session token if you are using the master key right?
Two questions there:

  1. If so, should we change the check on update user to not require sessionToken?
  2. How do we set it so that the code uses the master key only when doing parse operations?
    Thanks,
    -jim

Update user?

I don't think it's in the parseUser.php class. Can you update a user with additional fields or create a user with additional fields?

curl -X PUT
-H "X-Parse-Application-Id: Z0GKPdAmkIZsKg9nGgSGU52DQBUP2xavHmACYsAI"
-H "X-Parse-REST-API-Key: lOQHg18qhxveTkNA6YGIWDtwBpwQ9ULyK2ZwPqTh"
-H "X-Parse-Session-Token: pnktnjyb996sj4p156gjtp4im"
-H "Content-Type: application/json"
-d '{"phone":"415-369-6201"}'
https://api.parse.com/1/users/g7y9tkhB7O

Thanks,
-jim

PHP Loop

Hello guys! I'm doing something like this... A loop to trigger notifications.

This loop is supposed to run 10 times, but at the first time it reaches:

$request = $parse->notification($params);

It stops. The loop stops. How to fix it? Thank you!

Sample Code:

while($row = mysql_fetch_array($query)) {
....
$data = array(
'alert' => $message,
'badge' => '1',
'sound' => 'default'
);

        $params = array(
            'channel' => $row1['tus_usuar'],
            'type' => 'ios',
            'data' => $data
        );

        $request = $parse->notification($params);
        $sql2 = "UPDATE tab_comentarios SET fl_notif = '1' WHERE id = '$id'";
        $query2 = mysql_query($sql2, $conexao);

    }
}

Attachments, etc.

Hi!

We used your base and greatly modded from there. Have you done attachments yet?

We can do it via curl at the command line - but are working to integrate it w/ php. If you don't have something, I'll post inline as a response when we get it working today.

BTW, there is a user handler class for Java over in my repo.

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.