laravel卷曲不工作天蓝色

时间:2017-12-06 12:09:49

标签: php python laravel azure curl

我使用curl命令连接我的两个应用程序(laravel with python)。它在我的本地服务器上工作得非常好,无需更改单行,但是当它在azure服务器上时出现以下错误

  

POST https://myweb.com/searchJobs 500()

我的代码是

Self.Model: Naming

我是否需要在azure上更新任何安全协议或可能出现什么问题?

2 个答案:

答案 0 :(得分:0)

实际上这些行在localhost上工作正常,但在azure

上没有
$arr = "";
$arr['hello'] = '7';

所以我把它们改成了

$arr = [];
$arr['hello'] = '7';

虽然我不知道为什么azure没有运行它。如果php将它转换为localhost上的数组,那么它必须在azure上运行

答案 1 :(得分:0)

由于您使用的是azure appservice提供的默认域名。不要只使用HTTP协议,而是尝试使用HTTPS,因为这在提供的默认域上已经是免费的。在这种情况下,请尝试此更改。

$ch = curl_init();

    //URL to send the request to

    curl_setopt($ch, CURLOPT_URL, 'https://python-scrapper-python001.azurewebsites.net/myfunction');

    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json'));

    //We are doing a post request
    curl_setopt($ch, CURLOPT_POST, 1);

    //adding the post data to request
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data_json);

    //Return instead of outputting directly
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

    $output = curl_exec($ch);
        curl_close($ch);