Friday, 15 April 2011

CodeIgniter redirect to another function when request is made by cURL -


I have a function, "Function A", a codeigner controller that contains a function redirect, "Function B "to send an email when this data is collected to collect my problem is that when I enter the function A URL in the browser, the function works as expected and the redirect to function B works. .. But curl scroll to function a Is called by IV, and is it possible to redirect function in this scenario is used to do the function belongs but redirect function B does not work (when the request is made by curl)?

Can you show your curl code? I think you use something like this:

  $ ch = curl_init (); Curl_setopt ($ ch, CURLOPT_URL, $ url); Curl_setopt ($ CH, CURLOPT_HEADER, true); Curl_setopt ($ CH, CURLOPT_FOLLOWLOCATION, true); Curl_setopt ($ CH, CURLOPT_RETURNTRANSFER, TRUE); $ Result = curl_xac ($ CH); Curl_close ($ ch);   

Check this string (it must be set to true):

  curl_setopt ($ ch, CURLOPT_FOLLOWLOCATION, true);   

And you can use the next thing (in the example of topperren):

  function first_function () {ob_start (); // do stuff $ this- & gt; Second_function (); Ob_end_flush (); } Function second_function () {// send email}    

No comments:

Post a Comment