How to use PHP CURL to bypass cross domain

前端 未结 2 1942
长发绾君心
长发绾君心 2021-01-15 10:54

I need PHP to submit paramaters from one domain to another. JavaScript is not an option for my situation. I\'m now trying to use CURL with PHP, but have not been successful

2条回答
  •  一个人的身影
    2021-01-15 11:23

    Well, its bit late. But adding this answer for further readers who might face similar issue. This issue arises some times when we are sending php curl request from a domain hosted over http to a domain hosted over https (http over ssl).

    Just add below code snippet before curl execution.

    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $output = curl_exec($ch);
    

提交回复
热议问题