Jump to content

Recommended Posts

Posted

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...

Posted

This worked for me:

<?php namespace ProcessWire;
include("../index.php"); //bootstrap ProcessWire

// var_dump($wire->pages);

$http = new WireHttp();

var_dump($http);

 

  • Like 2
  • Thanks 1

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...