function testCurlReadfile() { ob_start(); $f = PSU::curl(self::$url . '/e', PSU::READFILE); $get = ob_get_contents(); ob_end_clean(); $this->assertEquals('E', $get); }
/** * Method to grab JSON data from a feed source URL and return it as an array * @param string $url A string containing the url of the feed source */ public function get_json_source($url) { // Set up the feed_data array $feed_data = array(); // PSU::curl throws an exception if the document doesn't return a perfect 200 error try { // Get the JSON data with a CURL request to the url $feed_data = \PSU::curl($url, \PSU::FILE_GET_CONTENTS); // Return the JSON decoded as an array return json_decode($feed_data, true); } catch (\PSUToolsException $e) { // For now, lets just grab the exception and put it into the session $_SESSION['errors'][] = $e->getMessage(); } return $feed_data; }
/** * workflow * * constructor initializes SOAP connection to the workflow wsdl * * @access public * @since version 0.1.0 */ function __construct($in = null) { if (is_null($in)) { if (PSU::isDev()) { $which = 'test'; $domain = 'https://www.dev.plymouth.edu/'; } else { $which = 'psc1'; $domain = 'https://www.plymouth.edu/'; } } else { $which = $in; } $this->_instance = $which; try { //$wsdl_url = "https://draco.plymouth.edu/wf".$this->_instance."/ws/services/WorkflowWS/v1_1?WSDL"; $wsdl_url = $domain . "webapp/workflow/" . $this->_instance . ".wsdl.xml"; if (PSU::curl($wsdl_url, PSU::FILE_GET_CONTENTS)) { $this->_client = new SoapClient($wsdl_url, array('trace' => 1, 'connection_timeout' => 5, 'cache_wsdl' => WSDL_CACHE_MEMORY)); } else { return false; } } catch (Exception $e) { return false; } $this->_num_soap_calls++; include 'oracle/' . $this->_instance . '_wf_webservice.php'; $this->_authentication = array('principal' => $_DB['oracle'][$this->_instance . '_wf_webservice']['username'], 'credential' => PSUSecurity::password_decode($_DB['oracle'][$this->_instance . '_wf_webservice']['password'])); // auth string for lookup }