Created
March 16, 2017 09:48
-
-
Save Tynael/44c9d5feb3e7fd051cd9cd917dbe8dfc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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