1

I've got aproblem with my php cUrl. It doesn't output anything so whenever i run this it will return: "didnt work"

$curl = curl_init();
$url = "https://www.google.com/";
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($curl);
curl_close($curl);
if ($result === FALSE) {
   print "didnt work!";
} else {
   print "worked!";
}

I've searched countless tutorials etc. and no sulotion worked for me. Thx for the help in advance :)

3
  • you need to setup properly for https , both the environment (CA certs), and the curl call itself. Commented Feb 20, 2019 at 13:01
  • Thank you sooo much o.o Commented Feb 20, 2019 at 13:05
  • Unable to reproduce - works (just some relative image links should be fixed to be absolute paths). Have you tried to output http response header ? Try adding option curl_setopt($curl, CURLOPT_HEADER, 1); and see the exact output with echo "<xmp>$result</xmp>";. What do you see ? Commented Feb 20, 2019 at 13:28

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.