Callback from API not happening after posting parameters to API URL from server side?

Try to debug your request using the curl_get_info() function: $header = curl_getinfo($ch); print_r($header) Your request might be OK but it my result in an error 404 EDIT : If you want to perform a post request, add this to your code: curl_setopt($ch, CURLOPT_POST, true) EDIT : Something else I mentioned at your code: You used a '1' at the 'CURLOPT_RETURNTRANSFER' but is should be 'true': curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1) At least this is how I usually do it, and you never know if the function will also understand a '1' as 'true EDIT : The real problem: I copy-pasted your source and used it on one of my pages getting this error: Warning: urlencode() expects parameter 1 to be string, array given in C:\xampp\htdocs\phptests\test. Php on line 8 The error is in this line: foreach($_postArray as $name => $value) $_postArray is an array with one value holding the other values and you need either another foreach or you simple use this: foreach($_postArray'customer_token' as $name => $value).

Try to debug your request using the curl_get_info() function: $header = curl_getinfo($ch); print_r($header); Your request might be OK but it my result in an error 404. EDIT: If you want to perform a post request, add this to your code: curl_setopt($ch, CURLOPT_POST, true); EDIT: Something else I mentioned at your code: You used a '1' at the 'CURLOPT_RETURNTRANSFER' but is should be 'true': curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); At least this is how I usually do it, and you never know if the function will also understand a '1' as 'true'; EDIT: The real problem: I copy-pasted your source and used it on one of my pages getting this error: Warning: urlencode() expects parameter 1 to be string, array given in C:\xampp\htdocs\phptests\test. Php on line 8 The error is in this line: foreach($_postArray as $name => $value) $_postArray is an array with one value holding the other values and you need either another foreach or you simple use this: foreach($_postArray'customer_token' as $name => $value).

The output of curl_getinfo($ch) gives - Array ( url => content_type => text/html http_code => 200 header_size => 163 request_size => 743 filetime => -1 ssl_verify_result => 0 redirect_count => 0 total_time => 0.183987 namelookup_time => 0.175189 connect_time => 0.175267 pretransfer_time => 0.175276 size_upload => 586 size_download => 0 speed_download => 0 speed_upload => 3185 download_content_length => -1 upload_content_length => -1 starttransfer_time => 0.183932 redirect_time => 0 )` So http_code is 200 (looks like no error). – Sandeepan Nath Aug 31 '10 at 14:18 Than your request is just empty. But I just saw, that you are trying to make a post request.

Than you also have to tell CURL about that. See my edit. – Kau-Boy Aug 31 '10 at 14:21 I did not write curl_setopt($ch, CURLOPT_POST, true); in my question by mistake.

Now added. Thanks, but the array output which I showed is for the case when curl_setopt($ch, CURLOPT_POST, true); is present in code. – Sandeepan Nath Aug 31 '10 at 14:28 ok I replaced the 0s and 1s in code and my question but no success.

Should the CURLOPT_RETURNTRANSFER be true or false? If I keep it true, echo $resp; does not give 1. I think that is just for getting the response.

– Sandeepan Nath Aug 31 '10 at 14:36 It must be true. But I think I found the real issue with your request, see my last edit. – Kau-Boy Aug 31 '10 at 14:39.

As discussed in the previous question, the callback is an entirely separate thing from your request. The callback also will not have your session variables, because the remote API is acting as the client to the callback script and has its own session. You should really show some API documentation here.

Maybe we're misunderstanding each other but as far as I can see, what you are trying to do (get the callback value in the initial CURL request) is futile, and doesn't become any less futile by asking twice.

I had left trying to get the callback value in the initial CURL request in my previous question after agreeing to your explanation. Now I am just trying to set a session value in the callback file, but that is not happening. – Sandeepan Nath Aug 31 '10 at 14:21 @sandeepan yes, in the callback file, the API acts as the "browser" so it will have a different session than your current one.

Usually, the API should return a unique key in the callback so you can tell which request it belongs to (or even continue the session if the key is a session ID). Is there really nothing to that effect in your API? That would be strange.

– Pekka Aug 31 '10 at 14:25 There are many strange things about this API, due to which I have struggled a lot. It is a still under bug fixing and they make changes when we find bugs. – Sandeepan Nath Aug 31 '10 at 14:30.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions