[在本地主机上运行良好,但在线给出警告Curl_setopt()期望参数1为资源,在null中给出

问题描述 投票:0回答:1

在我的本地主机上,它运行正常,但是在我的Web主机上,出现以下错误。

PHP警告:curl_setopt()期望参数1为资源,\ WINDOWSxxxx.LOCAWEB.COM.BR \ xxxx \ xxxxx \ pagamento.php在第15、16、18和19行中给出的空值

我不知道这是否是语法错误?

<?php

    include 'config.php';
    //session_start();
    #create the request
    $url = URL_PAGSEGURO."sessions?email=".EMAIL_PAGSEGURO."&token=".TOKEN_PAGSEGURO;

    //http://br2.php.net/manual/pt_BR/function.curl-setopt.php

    $curl = curl_init($url);
    curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: application/x-www-form-urlencoded; charset=UTF-8"));
    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_POSTFIELDS, true);

    $retorno = curl_exec($curl);
    curl_close($curl);

    $xml = simplexml_load_string($retorno);
    echo json_encode($xml);
javascript php curl localhost web-hosting
1个回答
0
投票
© www.soinside.com 2019 - 2024. All rights reserved.