markus_blue_tomato Posted September 18, 2019 Share Posted September 18, 2019 I try to access wie WireHttp Class in a script executed on the command line but I'm failing hard and don't know why. Access to the Pages Class works well. <?php // include PW API include(__DIR__ . "/index.php"); var_dump($wire->pages); var_dump($wire->http); php test.php object(ProcessWire\Pages)#172 (0) { } NULL Does anyone know why? ? I tried also new WireHttp(), wire('http'), $http... Link to comment Share on other sites More sharing options...
Sergio Posted September 18, 2019 Share Posted September 18, 2019 This worked for me: <?php namespace ProcessWire; include("../index.php"); //bootstrap ProcessWire // var_dump($wire->pages); $http = new WireHttp(); var_dump($http); 2 1 Link to comment Share on other sites More sharing options...
markus_blue_tomato Posted September 18, 2019 Author Share Posted September 18, 2019 aaah, the missing 'namespace ProcessWire;' was the problem. thx! 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now