Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize Online / SQLize Online  /  SQLtest Online

A A A
Login    Share code      Blog   FAQ

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

Copy Format Clear

Stuck with a problem? Got Error? Ask AI support!

Copy Clear
Copy Format Clear
<?php $url="https://world.openfoodfacts.org/api/v2/product/8002330064594.json"; echo $url."\r\n"; $options = array( CURLOPT_RETURNTRANSFER => true, // return web page CURLOPT_HEADER => true, // return headers CURLOPT_FOLLOWLOCATION => true, // follow redirects CURLOPT_MAXREDIRS => 10, // stop after 10 redirects CURLOPT_ENCODING => "", // handle compressed CURLOPT_CONNECTTIMEOUT => 120, // time-out on connect CURLOPT_TIMEOUT => 120, // time-out on response CURLOPT_USERAGENT => 'User-Agent: AldusNutritionFacts - Android - Version 1.0 - www.divinoracolo.com' ); $ch = curl_init($url); curl_setopt_array($ch, $options); $result = curl_exec($ch); $errors = curl_error($ch); $response = curl_getinfo($ch, CURLINFO_HTTP_CODE); print_r($ch); curl_close($ch); echo"ERR:".var_dump($errors); echo"RSP:".var_dump($response); echo"RES:".var_dump($result);
Copy Clear