1

I have a very basic html file with a jquery script loading a php file:

<!doctype html>

<html lang="en">
<head>
    <meta charset="utf-8">

    <title>Title</title>
    <meta name="description" content="Hello World!">
    <meta name="author">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.3/jquery.min.js"></script>

    <!-- <link rel="stylesheet" href="css/styles.css?v=1.0"> -->
</head>

<body>    
    <div id="dashboard-container">
    </div>    
    <!-- <script src="js/scripts.js"></script> -->
    <script>
        $(document).ready(function(){
            $("#dashboard-container").load('http://example.com/data/access_data.php');
        });
    </script>
</body>
</html>

The php file is accessing a SOAP-api and echos some data out:

$client = new SoapClient('http://www.e-conomic.com/secure/api1/EconomicWebService.asmx?wsdl');

$getAllOrders = $client->Order_GetAll();
$array = json_decode(json_encode($getAllOrders), True);

foreach($array as $data) {
    $array2 =  $data["OrderHandle"];
};

$sliced = array_slice($array2, -20, 20, true);
$reversed = array_reverse($sliced);

foreach ($reversed as $data) {
    $handle = $data["Id"];
    $getOrders = $client->Order_GetData(array(
        'entityHandle' => array(
            'Id' => "$handle"
        )
    ));
    $getOrders = json_decode(json_encode($getOrders), True);
    foreach ($getOrders as $data) {
        echo $data['DebtorName'] . ", " . $data['Heading'] . ", " . $data['IsSent'] . ", " . $data['DeliveryDate'] . ", " . $data['NetAmount'] . "<br>";
    }
};

Works great as long as the files are on the same location. Meaning that both are on either localhost or the same online server. But that's not meant to be so I need to be able to load the file from a remote server. If I try to do that with this code the php file doesn't load anymore. Even though the file is accessible on the linked address. This surprises me so does anybody has an explanation and solution for it?

gerre
  • 155
  • 1
  • 11

0 Answers0