planningcenter / developers

Planning Center API docs and support
https://developer.planning.center/docs/
85 stars 8 forks source link

Connect api via curl setup PHP doesn't work #1194

Closed jonnathanYepes closed 3 months ago

jonnathanYepes commented 3 months ago

My app have been conecting via curl on PHP and integrating well, but suddenly it doesnt connect.

This is the actual PHP script configuration but it doesn't work anymore:

init

$this->curl = curl_init();

option

curl_setopt($this->curl, CURLOPT_URL, $uri); curl_setopt($this->curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($this->curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($this->curl, CURLOPT_USERPWD,$this->appId.':'.$this->appSecret); curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($this->curl, CURLOPT_CUSTOMREQUEST,$method); curl_setopt($this->curl, CURLOPT_POSTFIELDS,$jsonData); curl_setopt($this->curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json','Content-Length: ' . strlen($jsonData)));

execute

$data = curl_exec($this->curl); // when it executes this line, it gets the error ""Warning: curl_exec(): supplied resource is not a valid CURL handle resource""

close

curl_close($this->curl);

Due to We dont change anything on the connect script, do you know if there is a new way to conect to you services.?

Thanks

seven1m commented 3 months ago

Nothing has changed on our side that would cause such an error. I have found that the built-in cURL functions in PHP are really hard to use. I'd recommend a third-party library with a nicer interface, such as Guzzle or Httpful. Sorry I cannot be of more help!