0

I am a complete n00b at using cURL and am trying to do a simple retrieval using $_POST. I think the problem may be the URL I am using, as it is https. Does anyone have a suggestion on how I can handle this.

Here is the code: formy.php

 <pre> <form name="test" method="post" action="formy.php"> <input
 type="text" name="name" size="40" />  <input type="submit"
 name="submit" value="submit" />  </form> </pre>

curl.php

$h = curl_init();

curl_setopt($h, CURLOPT_URL, "https://path/to/formy.php"; 
curl_setopt($h, CURLOPT_POST, true);
curl_setopt($h, CURLOPT_POSTFIELDS, array(
'name' => 'yes',
'submit' => 'submit'
));
curl_setopt($h, CURLOPT_HEADER, false);
curl_setopt($h, CURLOPT_RETURNTRANSFER, 1);

$result = curl_exec($h);
echo "Test" . $result;
AyB
  • 11,609
  • 4
  • 32
  • 47

1 Answers1

1

just add following option before curl_exec

curl_setopt($h, CURLOPT_SSL_VERIFYPEER, false);
Manish Goyal
  • 700
  • 1
  • 7
  • 17