Zoho reports PHP seems to no longer work
Hey gang, any help would be appreciated.
Background: Built a site sometime ago where I ported over what I believe was the Zoho reports php api library code. In particular, I think there was one that did the POST. I have not touched this code in ages, and recently it seems to be broke.
Offending code:
- $params = array('http' => array(
- 'method' => 'POST',
- 'content' => $data
- ));
- if ($optional_headers !== null) {
- $params['http']['header'] = $optional_headers;
- }
- $ctx = stream_context_create($params);
- $fp = @fopen($url, 'rb', false, $ctx);
- $response = @stream_get_contents($fp);
- if (!$fp) {
- throw new Exception("Problem with $url, $php_errormsg");
- }
- $response = @stream_get_contents($fp);
- if ($response === false) {
- throw new Exception("Problem reading data from $url, $php_errormsg");
- }
- return $response;
For some reason, this throws an exception now on line 13. This is failing on my first POST, which is to receive a ticket number. If I post the URL thrown in the exception into the browser, then I receive my ticket number just fine.
So I am wondering if perhaps the zoho api has changed? Should I just switch to using cURL?
Thanks in advance,
Steve