Skip to content

Instantly share code, notes, and snippets.

@Tynael
Created March 16, 2017 09:48
Show Gist options
  • Select an option

  • Save Tynael/44c9d5feb3e7fd051cd9cd917dbe8dfc to your computer and use it in GitHub Desktop.

Select an option

Save Tynael/44c9d5feb3e7fd051cd9cd917dbe8dfc to your computer and use it in GitHub Desktop.
<?php
//feedUri
$feedURL = 'http://localhost/opencart2.2.0.0/index.php?json=retargeting';
$time_start = microtime(true);
echo "<pre>";
///
$ch = curl_init($feedURL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$response = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_HTTP_CODE) != 200) {
throw new \Exception(
'Invalid header response. ' .
curl_getinfo($ch, CURLINFO_HTTP_CODE) .
" = " .
$feedURL
);
}
$result = json_decode($response);
foreach ($result as $product) {
var_dump($product->id);
var_dump($product->price);
var_dump($product->promo);
var_dump($product->inventory);
}
$time_end = microtime(true);
$time = $time_end - $time_start;
echo "\r\n::\r\n\r\n::Process Time: {$time}";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment