openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

DslHttp.class.php (481B)


      1 <?php
      2 
      3 namespace cms\generator\dsl;
      4 
      5 use dsl\context\BaseScriptableObject;
      6 use dsl\context\Scriptable;
      7 use util\Http;
      8 use util\json\JSON;
      9 
     10 class DslHttp  extends BaseScriptableObject
     11 {
     12 	public function get( $url )
     13 	{
     14 		return $this->request('GET', $url );
     15 	}
     16 
     17 	public function post($url )
     18 	{
     19 		return $this->request('POST', $url );
     20 	}
     21 
     22 	private function request($method, $url ) {
     23 		$http = new Http( $url );
     24 		$http->method = $method;
     25 		$http->request();
     26 		return $http->body;
     27 	}
     28 }