//Created stubs using https://www.wsdltophp.com/  
                      //Call GetReports
apiKey = isset($_POST['apiKey']) ? $_POST['apiKey'] : '';
            $apiType = isset($_POST['requestType']) ? $_POST['requestType'] : 0;
            $requestType = $_POST['requestType'];
            require_once 'pcm\PcmAutoload.php';
            date_default_timezone_set('America/New_York');
            $rfc_1123_date = gmdate('D, d M Y H:i:s T', time());
            $token = $apiKey; //
            $_response = '';
            $authHeader = new PcmStructAuthHeader($token, $rfc_1123_date);
            $_dataVersion = "current";

    $_requestType = "GetReports";
                    $_header = new PcmStructRequestHeader($_dataVersion, $_requestType);
                    $getReports = new PcmStructGetReports();
                    $reportReqBody = new PcmStructReportRequestBody();
                    $_stopLocArray = new PcmStructArrayOfStopLocation();
                    $stop[0] = new PcmStructStopLocation();
                    $stop[1] = new PcmStructStopLocation();
                    $_address1 = new PcmStructAddress();
                   // $_address1->setStreetAddress("1040 N. 2nd St.");  //Street level routing premium feature
                    $_address1->setCity("Philadelphia");
                    $_address1->setState("PA");
                    $_address1->setZip("19123");
                    $_address2 = new PcmStructAddress();
                    //$_address2->setStreetAddress("457 N. Harrison St.");  //Street level routing premium feature
                    $_address2->setCity("Princeton");
                    $_address2->setState("NJ");
                    $stop[0]->setAddress($_address1);
                    $stop[0]->setRegion(PcmEnumDataRegion::VALUE_NA);
                    $stop[1]->setAddress($_address2);
                    $stop[1]->setRegion(PcmEnumDataRegion::VALUE_NA);
                    $_stopLocArray->setStopLocation($stop);
                    $reportroute[0] = new PcmStructReportRoute();
                    $reportroute[0]->setRouteId("ks route");
                    $reportroute[0]->setStops($_stopLocArray);
                    $_reportingOptions = new PcmStructReportOptions();
                    //   $_reportingOptions->setUseTollData(true);  //tolls premium feature
                    //  $_reportingOptions->setTollDiscount('All');
                    $_reportingOptions->setUseCustomRoadSpeeds(FALSE);
                    $reportroute[0]->setReportingOptions($_reportingOptions);
                    $_options = new PcmStructRouteOptions();
                    $_options->setBordersOpen(true);
                    $_options->setHighwayOnly(true);
                    $_options->setRoutingType(PcmEnumRoutingType::VALUE_PRACTICAL);
                    $_options->setRouteOptimization(PcmEnumRouteOptimizeType::VALUE_NONE);
                    $_options->setVehicleType(PcmEnumVehicleType::VALUE_TRUCK);
                    $_truckCfg = new PcmStructTruckConfig();
                    $_truckCfg->setAxles("8");
                    $_truckCfg->setWeight("80000");
                    $_truckCfg->setHeight('11\'5"');
                    $_truckCfg->setWidth('96"');
                    //  $_options->setTruckCfg($_truckCfg);  //truck config premium feature
                    $reportroute[0]->setOptions($_options);
                    $_mileageReport = new PcmStructMileageReportType();
                    $_directionsReport = new PcmStructDirectionsReportType();
                    $_reportType[0] = new PcmStructReportType();
                    $_reportType[0] = $_mileageReport;
                    $_reportType[0]->THoursWithSeconds = TRUE;
                    $_reportType[1] = new PcmStructReportType();
                    $_reportType[1] = $_directionsReport;
                    //$_reportType[1]->setCondenseDirections(TRUE);  //premium feature to condense
                    $_arrayReportType = new PcmStructArrayOfReportType($_reportType);
                    $reportroute[0]->setReportTypes($_arrayReportType);
                    $_arrayreportRoute = new PcmStructArrayOfReportRoute();
                    $_arrayreportRoute->setReportRoute($reportroute);
                    $reportReqBody->setReportRoutes($_arrayreportRoute);
                    $reportReq = new PcmStructReportRequest($_header, $reportReqBody);
                    $getReports->setRequest($reportReq);
                    //Make the call
                    $pcmService = new PcmServiceGet();
                    $pcmService->setSoapHeaderAuthHeader($authHeader);
                    if ($pcmService->GetReports($getReports)) {
                        $_response = $pcmService->getResult();
                        $ct = PcmServiceGet::getSoapClient();
                    }
    if (is_soap_fault($_response))
                       print $_response->faultstring;
                 else {
      //$directions = $_response->GetReportsResult->Body->Reports->Report[1];
      //$directions[1]->
      $ct->__getLastRequest();
      $request = $ct->__getLastRequest();
      $encode = $ct->__getLastResponse();}


This sample may use features that are only available in our Premium WebServices. Please refer to our Features page to confirm what feature level you currently subscribe to.