Example #1
0
 /**
  * 
  * sets the POST/PUT fields to the curl resource
  * 
  * @param curl resource $ch
  * @param Request $request
  * @return curl resource
  */
 private function setPostFields($ch, Request $request)
 {
     $entityProperties = $request->getEntity();
     curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $request->getMethod());
     curl_setopt($ch, CURLOPT_POSTFIELDS, $entityProperties);
     curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Content-Length: ' . strlen($entityProperties)));
     return $ch;
 }