Twister1004 Posted January 9, 2009 Share Posted January 9, 2009 Hey everyone, this sucks, but I have no idea what this script is and what it does, (Go figure), I also have no idea what this function does. Could anyone help me? =) Error: Fatal error: Call to undefined function curl_init() in C:\Documents and Settings\Compaq_Owner\Desktop\Server Files\XAMPP\xampp\htdocs\StickamPHP\Services\Stickam\API\Base.php on line 73 <?php /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /** * PHP5 interface for Stickam API * * PHP version 5 or newer * * @category Services * @package Services_Stickam * @author Advanced Video Communications Inc. * @copyright 2008 Advanced Video Communications Inc. * @license * @link http://developer.stickam.com/ */ require_once '../Services/Stickam/Common.php'; /** * Services_Stickam_API_Base * * Abstract class for all Stickam API Classes * * @category Services * @package Services_Stickam_API_Base * @link http://developer.stickam.com/ */ abstract class Services_Stickam_API_Base { //{{{ request() /** * send a request to the API */ protected function request($api, array $args = array(), $method = null) { $url = Services_Stickam_Common::$URL . $api; $args['key'] = Services_Stickam_Common::$API_KEY; $args['rid'] = round(microtime(true) * 1000); $args = $this->sign($args); if ( $method == 'POST' ) { $result = $this->_http_post($url, $args); } else { $result = $this->_http_get($url, $args); } $this->debug($result . "\n"); $xml = @simplexml_load_string($result); if ( ! $xml instanceof SimpleXmlElement ) { throw new Services_Stickam_Exception( 'Could not parse XML response', 0 ); } return $xml; } //}}} //{{{ _http_get() /** * HTTP GET request */ private function _http_get($url, array $args = array()) { $url .= '?'; foreach ( $args as $k => $v ) { $url .= '&' . $k . '=' . urlencode($v); } $this->debug($url . "\n"); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, Services_Stickam_Common::$TIMEOUT); $result = curl_exec($ch); if ( curl_errno($ch) ) { throw new Services_Stickam_Exception( curl_error($ch), curl_errno($ch) ); } $info = curl_getinfo($ch); if ( $info['http_code'] != 200 ) { throw new Services_Stickam_Exception( 'Services not available.', $info['http_code'] ); } curl_close($ch); return $result; } //}}} //{{{ _http_post() /** * HTTP POST request */ protected function _http_post($url, array $args = array()) { $fields = ''; foreach ( $args as $k => $v ) { $fields .= '&' . $k . '=' . urlencode($v); } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $fields); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, Services_Stickam_Common::$TIMEOUT); $result = curl_exec($ch); if ( curl_errno($ch) ) { throw new Services_Stickam_Exception( curl_error($ch), curl_errno($ch) ); } $info = curl_getinfo($ch); if ( $info['http_code'] != 200 ) { throw new Services_Stickam_Exception( 'Services not available.', $info['http_code'] ); } curl_close($ch); return $result; } //}}} //{{{ sign() /** * Sign the request * * @link http://developer.stickam.com/index.php?title=Getting_Started#Validation */ protected function sign(array $args) { if ( isset($args['sig']) ) { unset($args['sig']); } $sig = ''; ksort($args); foreach ( $args as $k => $v ) { if ( $k == 'rid' ) continue; $sig .= $v; } $sig = $sig . Services_Stickam_Common::$SECRET_KEY . $args['rid']; $this->debug('sig: ' . $sig . "\n"); $args['sig'] = md5($sig); return $args; } //}}} //{{{ debug() public function debug($s = '') { if ( Services_Stickam_Common::$DEBUG ) { echo $s; } } //}}} } ?> Thanks for everyone's help =D Quote Link to comment https://forums.phpfreaks.com/topic/140210-stickams-script-d/ Share on other sites More sharing options...
Mikedean Posted January 9, 2009 Share Posted January 9, 2009 Looks like you have to enable cURL in the php.ini file to allow cURL support. Un-commenting 'extension=php_curl.dll' should do the job . Me thinks . Quote Link to comment https://forums.phpfreaks.com/topic/140210-stickams-script-d/#findComment-733719 Share on other sites More sharing options...
Twister1004 Posted January 10, 2009 Author Share Posted January 10, 2009 No, cURL is allowed on my PHP server. Any other ideas? Quote Link to comment https://forums.phpfreaks.com/topic/140210-stickams-script-d/#findComment-733805 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.