"GET", //set request type post or get CURLOPT_POST =>false, //set to GET CURLOPT_USERAGENT => $user_agent, //set user agent CURLOPT_COOKIEFILE =>"cookie.txt", //set cookie file CURLOPT_COOKIEJAR =>"cookie.txt", //set cookie jar CURLOPT_RETURNTRANSFER => true, // return web page CURLOPT_HEADER => false, // don't return headers CURLOPT_FOLLOWLOCATION => true, // follow redirects CURLOPT_ENCODING => "", // handle all encodings CURLOPT_AUTOREFERER => true, // set referer on redirect CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect CURLOPT_TIMEOUT => 120, // timeout on response CURLOPT_MAXREDIRS => 10, // stop after 10 redirects ); $ch = curl_init( $url ); curl_setopt_array( $ch, $options ); $content = curl_exec( $ch ); $err = curl_errno( $ch ); $errmsg = curl_error( $ch ); $header = curl_getinfo( $ch ); curl_close( $ch ); $header['errno'] = $err; $header['errmsg'] = $errmsg; $header['content'] = $content; return $header; } $response = str_replace( ']', '}', str_replace( '[', '{', $response['content'] ) ); // print_r($response);die(); $response = preg_replace( "/\r|\n/", "", $response ); $products = json_decode($response); $products = json_decode(json_encode($products), true); // print_r($products);exit; // SETUP ALL VARIABLES foreach( $products as $product ) : // TITLE $vars['title'] = $product['title']; // DESCRIPTION $vars['description'] = $product['description']; // IMAGES $vars['images']['main'] = $product['product_image']; // FILTER VARIABLES $print_var['filters'] = $print_var['options'] = ''; $count = 0; foreach( $product['filters'] as $filter ) : if( $vars['title'] == "bffvx") : $vars['filter_title'] = $vars['title']; foreach( $filter['options'] as $filter_key => $filter_value ) : if( $filter_value != 'false' ) $print_var['options'] .= '
' . $filter_key . ': ' . $filter_value . '
'; endforeach; elseif( $count == 0 ) : $vars['filter_title'] = $vars['title']; // print_r($filter); foreach( $filter as $filter_key => $filter_value ) : if( $filter_value != 'false' ) $print_var['options'] .= '
' . $filter_key . ': ' . $filter_value . '
'; endforeach; endif; $count ++; endforeach; endforeach; // print_r($product['filters']);die; // print_r($vars);die; // print_r($print_var['options']);die; // SETUP HTML FOR PDF $html = '

' . $vars['title'] . ' - (bffvx)

' . $vars['description'] . '

Additional Info


'; //echo $html;exit; // echo ''; // print_a($products); include( __DIR__.'/../../../../pdf/mpdf.php' ); // echo __DIR__;die(); $mpdf = new mPDF('c'); $mpdf->SetDisplayMode('fullpage'); $stylesheets[] = file_get_contents( __DIR__.'/../../../../style/pdf-print.css'); foreach( $stylesheets as $stylesheet ) $mpdf->WriteHTML( $stylesheet, 1 ); $mpdf->WriteHTML( $html ); $mpdf->Output(); exit; ?>