Child pages
  • Simple PHP web service client
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

We will use request as static XML string. In real environment the request will be generated dynamically.

We wil do a simple curl call to access web service in REST mode.

<?php
header('Content-type: text/xml');
$xml = '<ws:dataDeliveryRequest dateFrom="2014-01-01" dateTo="2014-01-30"
    xmlns="http://geomodel.eu/schema/data/request"
    xmlns:ws="http://geomodel.eu/schema/ws/data"
    xmlns:geo="http://geomodel.eu/schema/common/geo"
    xmlns:pv="http://geomodel.eu/schema/common/pv"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
     
    <site id="site1dummy" name="First site" lat="48.61259" lng="20.827079">
        <geo:terrain elevation="111" azimuth="112" tilt="11"/>
        <geo:horizon>0:5 7.5:3 15:7 22.5:0</geo:horizon>
        <pv:geometry xsi:type="pv:GeometryFixedOneAngle" azimuth="165" tilt="22"/>
        <pv:system installationType="FREE_STANDING" dateStartup="2011-06-01" availability="99">
            <pv:module type="ASI" count="10" nominalPower="560">
                <pv:degradation>3</pv:degradation>
                <pv:degradationFirstYear>8</pv:degradationFirstYear>
                <pv:surfaceReflectance>0.13</pv:surfaceReflectance>
                <pv:powerTolerance low="10" high="90"/>
                <pv:nominalOperatingCellTemp>15</pv:nominalOperatingCellTemp>
                <pv:openCircuitVoltageCoeff>7</pv:openCircuitVoltageCoeff>
                <pv:shortCircuitCurrentCoeff>4</pv:shortCircuitCurrentCoeff>
                <pv:PmaxCoeff>10</pv:PmaxCoeff>
            </pv:module>
            <pv:inverter count="2" interconnection="PARALLEL">
                <pv:efficiency xsi:type="pv:EfficiencyConstant" percent="94"/>
                <pv:startPower>10</pv:startPower>
                <pv:limitationACPower>5</pv:limitationACPower>
                <pv:nominalDCPower>8</pv:nominalDCPower>
            </pv:inverter>
            <pv:losses>
                <pv:acLosses cables="1" transformer="2.1"/>
                <pv:dcLosses cables="1.2" mismatch="0.65" snowPollution="7" monthlySnowPollution="4 2 3 4 5 7 8 4 7 4 5 1"/>
            </pv:losses>
            <pv:topology xsi:type="pv:TopologySimple" type="PROPORTIONAL" relativeSpacing="1.5"/>
        </pv:system>
    </site>
     
    <processing key="GHI DIF DNI PVOUT" summarization="HOURLY" terrainShading="true"/>
     
</ws:dataDeliveryRequest>';
$url = 'https://solargis.info/ws/rest/datadelivery/request?key=demo';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
  • No labels