Daniel Patriarca
Daniel Patriarca

Reputation: 365

Can a php web site connect to an existing Parse Server running on a different server?

I have 2 AWS instances running, one with a web page and one as the backend for an iOS app. I would like to use some images and data from the instance that drives the app on the php website for the app. Is there a way to have my php server connect to the parse server? I googled around and saw some documentation that suggested approaches to use PHP to access parse from the same serve, but I was hoping there was a way to connect to the parse serve from the separate server, basically the way the app connects to the parse in the swift code? Both of my servers are instances running on AWS from Bitnami stacks on the AWS marketplace, the PHP Bitnami and Parse Bitnami.

Upvotes: 0

Views: 342

Answers (2)

Davi Macêdo
Davi Macêdo

Reputation: 2984

Yes. Parse Platform has a specific SDK for PHP: https://docs.parseplatform.org/php/guide/

Just install the SDK in your PHP application and initialize it like this:

ParseClient::initialize('your app id', 'your rest key', 'your master key');
ParseClient::setServerURL('https://your-parse-server-address:port','parse');

Upvotes: 2

ivanivan
ivanivan

Reputation: 2215

Yes, the same way you access it via the iOS app - https based REST API calls.

https://docs.parseplatform.org/rest/guide/

For PHP, you'll probably want to look at the json_encode and json_decode functions, as well as file_get_contents for GET requests (if http wrappers are enabled) and/or the CURL module/extensions for POST, PUT, DELETE (and GET if url wrappers are disabled).

https://www.php.net/manual/en/book.curl.php

https://www.php.net/manual/en/function.json-decode.php

https://www.php.net/manual/en/function.json-encode.php

Upvotes: 2

Related Questions