{"id":137,"date":"2015-11-02T12:47:45","date_gmt":"2015-11-02T12:47:45","guid":{"rendered":"http:\/\/alain.fi\/?p=137"},"modified":"2019-07-30T04:00:26","modified_gmt":"2019-07-30T04:00:26","slug":"drupal-7-sessions","status":"publish","type":"post","link":"https:\/\/alain.fi\/?p=137","title":{"rendered":"Drupal 7 sessions"},"content":{"rendered":"<p><a href=\"https:\/\/api.drupal.org\/api\/drupal\/includes!session.inc\/7\" target=\"_blank\">https:\/\/api.drupal.org\/api\/drupal\/includes!session.inc\/7<\/a><\/p>\n<p>yeah, do not forget to define the base url, something like:<br \/>\n<strong>$base_url = &#8216;http:\/\/&#8217;.$_SERVER[&#8216;HTTP_HOST&#8217;];<\/strong><\/p>\n<p>I&#8217;d start php script like:<\/p>\n<pre>&lt;?php\r\n\r\ndefine('DRUPAL_ROOT', '..\/');\r\n $base_url = 'http:\/\/'.$_SERVER['HTTP_HOST'];\r\n\r\nrequire_once DRUPAL_ROOT . '\/includes\/bootstrap.inc';\r\n drupal_bootstrap(DRUPAL_BOOTSTRAP_SESSION);\r\n drupal_add_http_header('Content-Type', 'text\/html; charset=UTF-8');\r\n\r\ndrupal_session_initialize();\r\n drupal_session_regenerate();\r\n \/\/print_r($_SESSION);<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/api.drupal.org\/api\/drupal\/includes!session.inc\/7 yeah, do not forget to define the base url, something like: $base_url = &#8216;http:\/\/&#8217;.$_SERVER[&#8216;HTTP_HOST&#8217;]; I&#8217;d start php script like: &lt;?php define(&#8216;DRUPAL_ROOT&#8217;, &#8216;..\/&#8217;); $base_url = &#8216;http:\/\/&#8217;.$_SERVER[&#8216;HTTP_HOST&#8217;]; require_once DRUPAL_ROOT . &#8216;\/includes\/bootstrap.inc&#8217;; drupal_bootstrap(DRUPAL_BOOTSTRAP_SESSION); drupal_add_http_header(&#8216;Content-Type&#8217;, &#8216;text\/html; charset=UTF-8&#8217;); drupal_session_initialize(); drupal_session_regenerate(); \/\/print_r($_SESSION);<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-137","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/alain.fi\/index.php?rest_route=\/wp\/v2\/posts\/137","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alain.fi\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alain.fi\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alain.fi\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/alain.fi\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=137"}],"version-history":[{"count":5,"href":"https:\/\/alain.fi\/index.php?rest_route=\/wp\/v2\/posts\/137\/revisions"}],"predecessor-version":[{"id":173,"href":"https:\/\/alain.fi\/index.php?rest_route=\/wp\/v2\/posts\/137\/revisions\/173"}],"wp:attachment":[{"href":"https:\/\/alain.fi\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=137"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alain.fi\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=137"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alain.fi\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=137"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}