I have grabbed the library from github, and tried to see what the $response was by using print_R($response). All I get is;
null
What am I doing wrong with my request? I have entered the username and key of my notifo account, and filled out the 'title', 'msg', and 'uti' of the $params array.
print_R($notifo) gives;
Notifo_API Object
(
[apiUsername:protected] => ......
[apiSecret:protected] => xd92ef9......
)
As expected. print_R($params) gives expected results. But print_R($response) gives null??
Thoughts?
That is what I am expecting to get - but I get null.
I have not changed the variable names, so they are identical to the library given. Thus, $response is the return value of $notifo->send_notification($params)
I even put print_R statments in the Notifo_API.php library itself to see if any data was incorrect. In the function sendRequest(), $url seems ok, as does $data. But after the curl commands, the return value of $result = curl_exec($ch) is null.
When I do a test with this code;
<?php<br /> error_reporting(E_ALL);
ini_set('display_errors', '1');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,
'http://news.google.com/news?output=rss');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$contents = curl_exec ($ch);
echo $contents;
curl_close ($ch);
?>
it correctly returns Google's RSS feed.
Would it have anything to do with SSL? I have the SSL port open, but it is in use on another webserver setup. (hostname: www.abc.com.au has it, and this request is coming from control.abc.com.au - two different instances in IIS).
Even if I didn't get a response (due to some strange SSL forwarding happening), wouldn't the notification still proceed? Or is there some two-way comms before it does?
I have no idea! I went through GoDaddy, and I did whatever they told me to do! (I know what I need to know, so a lot of the things I do on my webserver are forgotten very quickly!) How would I go about checking this?
Freakin amazing! Adding those two lines worked, and I am getting proper responses, and the notification on my phone is working!
So, what did these lines do, what is the problem with having them there, and what should I do different?
Thanks!
If you are making a call to an https url, curl will (by default) check to make sure that the url's ssl certificate is trusted by the root certificate authorities. To do this, the root certificate authorities' certs need to be installed locally on the server. If this check fails, then curl will bail on the request and return null. Adding those two lines tells curl not to worry about those checks and make the request anyway. You normally add those lines if you a) trust the end site, and b) don't have the ability to install the root CA certs on your server (if you are using a shared host, for example).
It looks like you're new here. If you want to get involved, click one of these buttons!