<?php
namespace gnomephp\mvc;
class StateItem{
public $server;
public $post;
public function __construct($server, $post){
$this->server = $server;
$this->post = $post;
}
public function execute(){
// we must now execute the same regime of the state and give things back to the browser.
$c = \curl_init(\gnomephp\Url::link(substr($this->server['PATH_INFO'], 1)));
curl_setopt($c, CURLOPT_USERAGENT, $this->server['HTTP_USER_AGENT']);
if ($this->post){
curl_setopt($c, CURLOPT_POST, true);
curl_setopt($c, CURLOPT_POSTFIELDS, $this->post);
}
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
return curl_exec($c);
}
}