We have a need to pull in data from an external source using PHP. I’ve run into this issue before where EE doesn’t like the PHP formatting i’m using, yet it seems to work elsewhere. For example, if i type the same code into phpfiddle it works fine. When i put it into EE i get the error {!– ra:000000007fef5f44000000007fd6e88d –} or something similar. Please see the code below. Any ideas of why this wouldn’t work? I do put the API key in and “URLGOESHERE” is where the actual API URL is.. i just removed for here.Thanks!
<?php
require “util/httpful.phar”;
$API_KEY = “”;
$startAt = 1;
$maxReturn = 20;
$url = “https://URLGOESHERE/sws/v1/offers/cruise?filter=supplier_id=26;searchable_destination_id=2&fields=offer_id,title&start;_at={$startAt}&max;_return={$maxReturn}”;
$response = Httpful\Request::get($url) ->addHeader(‘api_key’, $API_KEY) ->send();
$offers = json_decode($response, true);
$total = $response->body->meta->total;
$returnHtml = “<h1>Top Cruises</h1><ul>”; foreach( $offers[“offers”] as $offer ){
$returnHtml .= “<li><a href=”https://URLGOESHERE/index.cfm/cruise/offer/index?offerID={$offer">{$offer['offer_id']} - {$offer['title']}</li>”;
$returnHtml .= “</ul>”; $returnHtml .= “Showing results {$startAt} - {$maxReturn} of {$total}”;
echo $returnHtml;
?>