Ejemplo n.º 1
0
 /**
  * Sets the needed static variables
  * 
  * @return  void
  */
 private static function _setStaticVars()
 {
     // Gets the instance of the string utilities
     self::$_str = Woops_String_Utils::getInstance();
     // Gets the instance of the string utilities
     self::$_array = Woops_Array_Utils::getInstance();
     // Gets the instance of the file types class
     self::$_fileTypes = Woops_File_Types::getInstance();
     // Gets the instance of the environment object
     self::$_env = Woops_Core_Env_Getter::getInstance();
     // Sets the newline character (CR-LF)
     self::$_CRLF = self::$_str->CR . self::$_str->LF;
     // Sets the boundary for multipart/form-data
     self::$_boundary = 'WOOPS-' . self::$_str->uniqueId();
     // Static variables are set
     self::$_hasStatic = true;
 }
Ejemplo n.º 2
0
#                               COPYRIGHT NOTICE                               #
#                                                                              #
# Copyright (C) 2009 Jean-David Gadina - www.xs-labs.com                       #
# All rights reserved                                                          #
################################################################################
# $Id$
// Includes the initialization script
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'init.inc.php';
// Plain text content
header('Content-Type: text/plain');
// WOOPS environment object
$ENV = Woops_Core_Env_Getter::getInstance();
// URL of the test file
$URL = ($ENV->HTTPS ? 'https://' : 'http://') . $ENV->HTTP_HOST . $ENV->getSourceWebPath('tests/http-client/test.php');
// Creates an HTTP client
$CLIENT = new Woops_Http_Client($URL);
// Adds some POST data
$CLIENT->addPostData('test', array('foo' => true, 'bar' => array('fooBar' => true)));
// Uploads a file
$CLIENT->addFile('someFile', $ENV->getPath('woops-mod://Cms/resources/templates/woops-default/lixado.png'));
// Establish the connection
$CLIENT->connect();
// Writes the HTTP response body
print $CLIENT->getResponse()->getBody();
// Separator
print chr(10) . '-----' . chr(10) . chr(10);
// Prints the cookies from the response
print 'Cookies from the HTTP response: ';
print_r($CLIENT->getResponse()->getCookies());
// Aborts the script
exit;