function preview_ajax_request($template_id) { $params = array(); //Preparing params for image generating request to zetaprints foreach ($_POST as $key => $value) { if (strpos($key, 'zetaprints-') !== false) { $_key = substr($key, 11); $_key = substr($_key, 0, 1) . str_replace('_', ' ', substr($_key, 1)); $params[$_key] = str_replace("\n", "\r\n", $value); } } //$params['ID'] = get_zp_user_id(); $params['From'] = '0'; //Sending image generating request to zetaprints list($header, $content) = zp_api_common_post_request('http://zetaprints.com', '/?page=template-preview-ecard;TemplateID=' . $template_id, $params); //BUG. Getting strange numbers in the content list(, $url) = explode("\r\n", $content); return $url; }
/** * register user to w2p * @param user * @param pass * @param key ApiKey * @param url Url of ZentaPrints site * @return 1 : registe new ok * 0: user is registed * -1: registe new error */ function zp_api_user_register($user, $pass, $key = null, $url = null) { if ($key) { zp_api_init($key, $url); } global $zp_api_key; global $zp_api_url; zp_api_log_debug("zp_api_user_register:start url=[{$zp_api_url}],key=[{$zp_api_key}]"); if (!$zp_api_key || !$zp_api_url) { zp_api_log_error("zp_api_user_register:error, null param url=[{$zp_api_url}],key=[{$zp_api_key}]"); return -1; } //Get path $path = "/API.aspx?page=api-user-new"; $data = array(); $data['UserID'] = $user; $data['Password'] = $pass; $data['ApiKey'] = $zp_api_key; zp_api_log_debug("zp_api_user_register:request"); list($header, $content) = zp_api_common_post_request($zp_api_url, $path, $data); zp_api_log_debug("zp_api_user_register:request:end"); return zp_api_common_xml_user_register_result($content); }