I am trying to execute this curl command via php but I'm unable to send the urlencode data with GET request
This is my curl command
curl -X GET \
-H "X-Parse-Application-Id: ..." \
-H "X-Parse-REST-API-Key: ..." \
-G \
--data-urlencode "where={\"createdAt\": \"2016-01-07T20:38:02.428Z\"}" \
https://api.parse.com/1/classes/Books';
This is my php code till yet
<?php
header('Content-Type: application/json');
$ParseAppID = "X-Parse-Application-Id: ... " ;
$ParseRestKey = "X-Parse-REST-API-Key: ... " ;
//$ParseMasterKey = ;
$GET ="GET";
$data = array("createdAt"=>"2016-01-09T08:42:36.675Z");
$data_string = json_encode($data);
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $GET);
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt($curl, CURLOPT_HEADER, FALSE);
curl_setopt($curl, CURLOPT_HTTPHEADER, array($ParseAppID, $ParseRestKey));
curl_setopt($ch, CURLOPT_POSTFIELDS, urlencode('where='.$data_string));
curl_setopt($curl, CURLOPT_URL, "https://api.parse.com/1/classes/Text");
$result = curl_exec( $curl );
curl_close( $curl );
echo $result;
?>