Witam,
posiadam następujący kod:
function List($campaign_id)
{
require 'config.php';
$date = '2011-07-31';
//$date = date('Y-m-d');
$ch = curl_init();
$url = "https://{$settings['client_name']}.directtrack.com/apifleet/rest/{$settings['client_name']}/".
"{$settings['access_id']}/leadDetail/campaign/{$campaign_id}/".$date."/";
$headers[] = "Authorization: Basic ".base64_encode($settings['username'].":".$settings['password']);
// Initiate the REST call via curl
$ch = curl_init($url);
// Set the HTTP method to GET
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
// Add the headers defined above
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
// Don't return headers
curl_setopt($ch, CURLOPT_HEADER, false);
// Return data after call is made
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$xml = simplexml_load_string($response, 'SimpleXMLElement', LIBXML_NOCDATA);
foreach($xml->children() as $lead)
{
$a = explode('/',$lead['location']); }
return $return;
else
return false;
}
Skrypt zwraca taki bład:
Cytat
Fatal error: Call to a member function children() on a non-object in
. Próbowałem już wszystkiego i nadal nie wiem dlaczego tak się dzieje.
Ten post edytował mlody69 4.08.2012, 14:16:09