/**
 * Parses for the XML Response in the MIME multipart message.
 * @param string $response MIME multipart message
 * @return string XML Response
 */
function parseForResponseXML($response)
{
    $beginResponseXML = strpos($response, '<?xml');
    $endResponseXML = strpos($response, '</downloadFileResponse>', $beginResponseXML);
    //Assume a service level error and die.
    if ($endResponseXML === FALSE) {
        $errorXML = parseForErrorMessage($response);
        PrintUtils::printXML($errorXML);
        die;
    }
    $endResponseXML += strlen('</downloadFileResponse>');
    return substr($response, $beginResponseXML, $endResponseXML - $beginResponseXML);
}
    global $debug;
    $request = $_POST['userRequest'];
    if (get_magic_quotes_gpc()) {
        $request = stripslashes($request);
    }
    return $request;
}
if (isset($_POST['userRequest'])) {
    $session = new LargeMerchantServiceSession('XML', 'XML', ENV_SANDBOX);
    $request = getRequest();
    $responseXML = $session->sendBulkDataExchangeRequest('startDownloadJob', $request);
    $xml = simplexml_load_string($responseXML);
    if (!empty($xml) && 'Success' == (string) $xml->ack) {
        $id_array = array("JobID" => (string) $xml->jobId);
    }
    PrintUtils::printXML($responseXML);
    parseResponseAndPrintExamples($xml);
}
?>
<hr />
<a href="./../index.php">Index</a>
<?php 
if (!empty($id_array['JobID'])) {
    ?>
<a href="./../GetJobStatus/GetJobStatus.php?jobId=<?php 
    echo $id_array['JobID'];
    ?>
">GetJobStatus</a>
<?php 
}
if (!empty($debug)) {
示例#3
0
//set the timestamp
define('d', date("m/d/Y H:i:s"));
//concatenate src and utils to the include path on the fly
set_include_path(get_include_path() . PATH_SEPARATOR . "src" . PATH_SEPARATOR . "utils");
//parse the config file
$config = parse_ini_file("config.ini", true);
include_once "LiveIdManager.php";
include_once "EntityUtils.php";
include_once 'PrintUtils.php';
include_once 'CrmAPIContext.php';
$liveIDUseranme = $config["dynamics"]["crmUserId"];
$liveIDPassword = $config["dynamics"]["crmPassword"];
$organizationServiceURL = $config["dynamics"]["organizationServiceURL"];
$liveIDManager = new LiveIDManager();
$securityData = $liveIDManager->authenticateWithLiveID($organizationServiceURL, $liveIDUseranme, $liveIDPassword);
if ($securityData != null && isset($securityData)) {
    echo "\nKey Identifier:" . $securityData->getKeyIdentifier();
    echo "\nSecurity Token 1:" . $securityData->getSecurityToken0();
    echo "\nSecurity Token 2:" . $securityData->getSecurityToken1();
} else {
    echo "Unable to authenticate LiveId.";
    return;
}
echo "\n";
$dynamicsCrm = new CrmAPIContext();
$accountId = $dynamicsCrm->createOrg($organizationServiceURL, $securityData, "New Org created by Rajesh\\'s app" . d);
PrintUtils::dump($dynamicsCrm->readOrg($accountId, $organizationServiceURL, $securityData));
$dynamicsCrm->updateOrg($accountId, $organizationServiceURL, $securityData, "New Org name Updated by Rajesh\\'s app_" . d);
PrintUtils::dump($dynamicsCrm->readOrg($accountId, $organizationServiceURL, $securityData));
//Uncomment only if you want to delete the created org
//$dynamicsCrm->deleteOrg($accountId, $organizationServiceURL, $securityData);
示例#4
0
<?php

require_once __DIR__ . '\\..\\utils\\PrintUtils.php';
/**
 * Created by PhpStorm.
 * User: evans
 * Date: 2015/12/10
 * Time: 15:36
 * 浮点数
 */
//使用一下语法定义,太大了会自动使用科学计数法
$a = 1.234;
$b = 1200.0;
$c = 0.007;
$d = 7000.0;
$e = 7.0E+20;
PrintUtils::var_dump($a, $b, $c, $d, $e);
示例#5
0
//值(value)可以是任意类型的值
$a = array(1 => "one", 2 => "two");
//短数组定义法,php5.4起
$b = [1 => "one", 2 => "two"];
PrintUtils::var_dump($a, $b);
/**
 * tip :
 * 包含有合法整型值的字符串会被转换为整型。例如键名 "8" 实际会被储存为 8。但是 "08" 则不会强制转换,因为其不是一个合法的十进制数值。
 * 浮点数也会被转换为整型,意味着其小数部分会被舍去。例如键名 8.7 实际会被储存为 8。
 * 布尔值也会被转换成整型。即键名 true 实际会被储存为 1 而键名 false 会被储存为 0。
 * Null 会被转换为空字符串,即键名 null 实际会被储存为 ""。
 * 数组和对象不能被用为键名。坚持这么做会导致警告:Illegal offset type
 */
//混合integer和string键名
$c = array("foo" => "bar", "bar" => "foo", 100 => -100, -100 => 100, 101);
$d = array("foo", "bar", "hallo", "world");
//给部分键名
$e = ["a", "b", "c", 6 => "d", "e"];
PrintUtils::var_dump($c, $d, $e);
//访问数组单元[],也可以使用{}代替
$f = array("foo" => "bar", 42 => 24, "multi" => array("dimensional" => array("array" => "foo")));
//对数组赋值,直接指定地方或者不指定(根据最大键值名字)
$f[1] = "new";
$f[] = "new";
PrintUtils::var_dump($f, $f["foo"], $f[42], $f["multi"]["dimensional"]["array"]);
//删除数组
unset($f[1]);
unset($f);
/*PrintUtils::var_dump($f, $f["foo"], $f[42], $f["multi"]["dimensional"]["array"]);*/
//重新索引数组
var_dump(array_values($e));