extension.php (981B)
1 <?php 2 class Controller3rdPartyExtension extends Controller { 3 public function index() { 4 $curl = curl_init(); 5 6 curl_setopt($curl, CURLOPT_POST, true); 7 curl_setopt($curl, CURLOPT_HEADER, false); 8 curl_setopt($curl, CURLOPT_URL, 'https://www.opencart.com/index.php?route=extension/json/extensions'); 9 curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1'); 10 curl_setopt($curl, CURLOPT_FRESH_CONNECT, true); 11 curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); 12 curl_setopt($curl, CURLOPT_FORBID_REUSE, true); 13 curl_setopt($curl, CURLOPT_TIMEOUT, 30); 14 curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); 15 curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); 16 curl_setopt($curl, CURLOPT_POSTFIELDS, array()); 17 18 $response = curl_exec($curl); 19 20 curl_close($curl); 21 22 $this->response->addHeader('Content-Type: application/json'); 23 $this->response->setOutput($response); 24 } 25 }