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;
只需在curl_exec之前添加以下选项
curl_setopt($h, CURLOPT_SSL_VERIFYPEER, false);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.