Welcome Guest, Not a member yet? Register   Sign In
cURL call to CI controller/function loses URI parameters
#1

[eluser]mikertjones[/eluser]
Hello all

I have a project which requires process forking - a long server-side process is holding up the client browser and anyway it's not web related, it's building a lot of emails and storing them in a database table as an email queue.

So the controller function calls a vanilla PHP script using exec() and passes 2 arguments.

The vanilla PHP script then spawns a new process using cURL; the URL is accessing the same controller but a specific function to kick off the processing of the emails.

I am trying to pass the 2 arguments to the controller function as URI parameters in the cURL init URL to use them in the process.

thus: $ch = curl_init("https://<domain>/<ctrllr>/<function>/paramA/paramB");

The controller function is executed OK but the parameters are lost in the call. The controller function has the variables defined in the parentheses.

If, however, I paste the url into a browser address bar the function is called and the parameters get to where they are needed.

I even tried including index.php in the url - https://<domain>/index.php/<ctrllr>/<function>/paramA/paramB - no success.

Any thoughts why calling using cURL should lose the parameters where pasting in a browser works fine?

Also using cURL in this way works fine on the development server - i.e. my local PC.

Are there any tests I should try?

Any help would be great.

Thanks

Mike Jones


***UPDATE***

You know sometimes when you've got your head inside something and you can't see outside it? Well, this was one of those times - aaaaarrrrrgggghhhh!

Earlier I had been trialling and erroring to get php exec() to work on my shared host server and that meant trying differnt paths for the php executable and different paths for the vanilla script.

So, guess what happened when I finally found the principle worked - I went ahead and edited the wrong script to test the parameter passing.

Of course it works fine - cold light of day and all that.

Sorry to bother you all.

Mike Jones




Theme © iAndrew 2016 - Forum software by © MyBB