-1

I need to run code always when magento starts. Which means any user who visit site must go through this code. Please any one know place to add this code

session_start(); 
$cookie = 'PHPSESSID=' . $_COOKIE['PHPSESSID'];

session_write_close(); 

$ch = curl_init('url_here');
...
...
...
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
...
... 
curl_exec($ch); 
curl_close($ch); 
0

You can also use the magento event controller_action_predispatch which always get executed. You can bind your code by creating an observer on this event.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.