This information relates to users making API requests to ChannelUnity.
When making requests to the ChannelUnity API, an HTTP header forcing a 302 redirect may be returned. This redirect must be followed, and the POST data must also be sent to the new URL. In some cases this doesn’t happen by default. The sample code below demonstrates following redirects including resubmitting POST data.
For those using PHP, two lines need to be added (if not already present) to any API call made to ChannelUnity. Please note this is the only change required, and all other functionality will continue to work without modification.
curl_setopt($session, CURLOPT_URL, "https://my.channelunity.com/event.php"); curl_setopt($session, CURLOPT_POST, true); curl_setopt($session, CURLOPT_RETURNTRANSFER, true); curl_setopt($session, CURLOPT_VERBOSE, true); curl_setopt($session, CURLOPT_POSTFIELDS, array('message' => $xml)); curl_setopt($session, CURLOPT_FOLLOWLOCATION, true); // Add this line curl_setopt($session, CURLOPT_POSTREDIR, CURL_REDIR_POST_ALL); // Add this line
Add the --post302 and --location command line arguments. More information at this link: