curl API return blank page in Magento 2












0















I m trying to implement worldpay on a PHP site using XML direct method but whenever I try to connect I get blank pag.. Can you tell me were you testing the payment gateway on live site.
Code:



    $url = 'https://secure.worldpay.com/sso/public/auth/login.html?serviceIdentifier=merchantadmin';
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, $url );
curl_setopt($ch, CURLOPT_USERPWD, "username
:password");
curl_setopt( $ch, CURLOPT_POST, true );
curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch, CURLOPT_POSTFIELDS, $xml );
$result = curl_exec($ch);
// curl_close($ch);
// echo json_encode($result);
// exit;
return $this->_pageFactory->create();


How to solve it?
Anyone can help me to solve this
i was used this payment-gateway .










share|improve this question

























  • make sure you are using this api token url /rest/V1/integration/admin/token

    – magefms
    yesterday













  • I used my payment gateway administration Interface url

    – divya sekar
    yesterday











  • try this one $adminUrl = "127.0.0.1/your_Magento_dir/rest/V1/integration/admin/token"

    – magefms
    yesterday













  • assuming you are running on localhost 127.0.0.1

    – magefms
    yesterday











  • modify your $adminUrl value like that one

    – magefms
    yesterday
















0















I m trying to implement worldpay on a PHP site using XML direct method but whenever I try to connect I get blank pag.. Can you tell me were you testing the payment gateway on live site.
Code:



    $url = 'https://secure.worldpay.com/sso/public/auth/login.html?serviceIdentifier=merchantadmin';
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, $url );
curl_setopt($ch, CURLOPT_USERPWD, "username
:password");
curl_setopt( $ch, CURLOPT_POST, true );
curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch, CURLOPT_POSTFIELDS, $xml );
$result = curl_exec($ch);
// curl_close($ch);
// echo json_encode($result);
// exit;
return $this->_pageFactory->create();


How to solve it?
Anyone can help me to solve this
i was used this payment-gateway .










share|improve this question

























  • make sure you are using this api token url /rest/V1/integration/admin/token

    – magefms
    yesterday













  • I used my payment gateway administration Interface url

    – divya sekar
    yesterday











  • try this one $adminUrl = "127.0.0.1/your_Magento_dir/rest/V1/integration/admin/token"

    – magefms
    yesterday













  • assuming you are running on localhost 127.0.0.1

    – magefms
    yesterday











  • modify your $adminUrl value like that one

    – magefms
    yesterday














0












0








0








I m trying to implement worldpay on a PHP site using XML direct method but whenever I try to connect I get blank pag.. Can you tell me were you testing the payment gateway on live site.
Code:



    $url = 'https://secure.worldpay.com/sso/public/auth/login.html?serviceIdentifier=merchantadmin';
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, $url );
curl_setopt($ch, CURLOPT_USERPWD, "username
:password");
curl_setopt( $ch, CURLOPT_POST, true );
curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch, CURLOPT_POSTFIELDS, $xml );
$result = curl_exec($ch);
// curl_close($ch);
// echo json_encode($result);
// exit;
return $this->_pageFactory->create();


How to solve it?
Anyone can help me to solve this
i was used this payment-gateway .










share|improve this question
















I m trying to implement worldpay on a PHP site using XML direct method but whenever I try to connect I get blank pag.. Can you tell me were you testing the payment gateway on live site.
Code:



    $url = 'https://secure.worldpay.com/sso/public/auth/login.html?serviceIdentifier=merchantadmin';
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, $url );
curl_setopt($ch, CURLOPT_USERPWD, "username
:password");
curl_setopt( $ch, CURLOPT_POST, true );
curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch, CURLOPT_POSTFIELDS, $xml );
$result = curl_exec($ch);
// curl_close($ch);
// echo json_encode($result);
// exit;
return $this->_pageFactory->create();


How to solve it?
Anyone can help me to solve this
i was used this payment-gateway .







magento2 payment-gateway curl






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 16 mins ago







divya sekar

















asked yesterday









divya sekardivya sekar

13012




13012













  • make sure you are using this api token url /rest/V1/integration/admin/token

    – magefms
    yesterday













  • I used my payment gateway administration Interface url

    – divya sekar
    yesterday











  • try this one $adminUrl = "127.0.0.1/your_Magento_dir/rest/V1/integration/admin/token"

    – magefms
    yesterday













  • assuming you are running on localhost 127.0.0.1

    – magefms
    yesterday











  • modify your $adminUrl value like that one

    – magefms
    yesterday



















  • make sure you are using this api token url /rest/V1/integration/admin/token

    – magefms
    yesterday













  • I used my payment gateway administration Interface url

    – divya sekar
    yesterday











  • try this one $adminUrl = "127.0.0.1/your_Magento_dir/rest/V1/integration/admin/token"

    – magefms
    yesterday













  • assuming you are running on localhost 127.0.0.1

    – magefms
    yesterday











  • modify your $adminUrl value like that one

    – magefms
    yesterday

















make sure you are using this api token url /rest/V1/integration/admin/token

– magefms
yesterday







make sure you are using this api token url /rest/V1/integration/admin/token

– magefms
yesterday















I used my payment gateway administration Interface url

– divya sekar
yesterday





I used my payment gateway administration Interface url

– divya sekar
yesterday













try this one $adminUrl = "127.0.0.1/your_Magento_dir/rest/V1/integration/admin/token"

– magefms
yesterday







try this one $adminUrl = "127.0.0.1/your_Magento_dir/rest/V1/integration/admin/token"

– magefms
yesterday















assuming you are running on localhost 127.0.0.1

– magefms
yesterday





assuming you are running on localhost 127.0.0.1

– magefms
yesterday













modify your $adminUrl value like that one

– magefms
yesterday





modify your $adminUrl value like that one

– magefms
yesterday










2 Answers
2






active

oldest

votes


















1
















  1. This is the Data




dataFormat = array('temp_order_id'=>$qouteId, 'MobileNumber'=>$mobileNo, 'OTP'=>$otp, 'Amount'=>$amount); $response = $helper->getcurlDataArray($dataFormat,"username" => $merchant_user,"password" => $merchant_password, $adminUrl);




  1. Here I'm calling Helper function




$response = $helper->getcurlDataArray($dataFormat,"username" => $merchant_user,"password" => $merchant_password, $adminUrl);




  1. Here is the Helper function




public function getcurlDataArray($dataFormat,$username,$password,$service_url){

$ch = curl_init($service_url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($dataFormat));
curl_setopt($ch, CURLOPT_USERPWD, $username. ":" .$password);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
$token = curl_exec($ch);
if (curl_error($ch)) {
$error_msg = curl_error($ch);
$Errorhead = 'CurlError for Url:'.$service_url.' DataFormat:'.json_encode($dataFormat);
$this->logError($Errorhead,$error_msg);
}
$response = json_decode($token,true);
return $response;
}





share|improve this answer

































    0














    dataFormat = array('temp_order_id'=>$qouteId, 'MobileNumber'=>$mobileNo, 'OTP'=>$otp, 'Amount'=>$amount); $response = $helper->getcurlDataArray($dataFormat,"username" => $merchant_user,"password" => $merchant_password, $adminUrl);




    1. Here I'm calling Helper function




    $response = $helper->getcurlDataArray($dataFormat,"username" => $merchant_user,"password" => $merchant_password, $adminUrl);




    1. Here is the Helper function




    public function getcurlDataArray($dataFormat,$username,$password,$service_url){

    $ch = curl_init($service_url);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($dataFormat));
    curl_setopt($ch, CURLOPT_USERPWD, $username. ":" .$password);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
    $token = curl_exec($ch);
    if (curl_error($ch)) {
    $error_msg = curl_error($ch);
    $Errorhead = 'CurlError for Url:'.$service_url.' DataFormat:'.json_encode($dataFormat);
    $this->logError($Errorhead,$error_msg);
    }
    $response = json_decode($token,true);
    return $response;





    share|improve this answer


























    • @divya sekar, Please check this code might be it will be helpful for u

      – Umarfarooq Galibwale
      yesterday











    • i will tried and update u @Umar

      – divya sekar
      yesterday











    • no i was getting a null value @umar

      – divya sekar
      yesterday











    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "479"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f261724%2fcurl-api-return-blank-page-in-magento-2%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1
















    1. This is the Data




    dataFormat = array('temp_order_id'=>$qouteId, 'MobileNumber'=>$mobileNo, 'OTP'=>$otp, 'Amount'=>$amount); $response = $helper->getcurlDataArray($dataFormat,"username" => $merchant_user,"password" => $merchant_password, $adminUrl);




    1. Here I'm calling Helper function




    $response = $helper->getcurlDataArray($dataFormat,"username" => $merchant_user,"password" => $merchant_password, $adminUrl);




    1. Here is the Helper function




    public function getcurlDataArray($dataFormat,$username,$password,$service_url){

    $ch = curl_init($service_url);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($dataFormat));
    curl_setopt($ch, CURLOPT_USERPWD, $username. ":" .$password);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
    $token = curl_exec($ch);
    if (curl_error($ch)) {
    $error_msg = curl_error($ch);
    $Errorhead = 'CurlError for Url:'.$service_url.' DataFormat:'.json_encode($dataFormat);
    $this->logError($Errorhead,$error_msg);
    }
    $response = json_decode($token,true);
    return $response;
    }





    share|improve this answer






























      1
















      1. This is the Data




      dataFormat = array('temp_order_id'=>$qouteId, 'MobileNumber'=>$mobileNo, 'OTP'=>$otp, 'Amount'=>$amount); $response = $helper->getcurlDataArray($dataFormat,"username" => $merchant_user,"password" => $merchant_password, $adminUrl);




      1. Here I'm calling Helper function




      $response = $helper->getcurlDataArray($dataFormat,"username" => $merchant_user,"password" => $merchant_password, $adminUrl);




      1. Here is the Helper function




      public function getcurlDataArray($dataFormat,$username,$password,$service_url){

      $ch = curl_init($service_url);
      curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
      curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($dataFormat));
      curl_setopt($ch, CURLOPT_USERPWD, $username. ":" .$password);
      curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
      $token = curl_exec($ch);
      if (curl_error($ch)) {
      $error_msg = curl_error($ch);
      $Errorhead = 'CurlError for Url:'.$service_url.' DataFormat:'.json_encode($dataFormat);
      $this->logError($Errorhead,$error_msg);
      }
      $response = json_decode($token,true);
      return $response;
      }





      share|improve this answer




























        1












        1








        1









        1. This is the Data




        dataFormat = array('temp_order_id'=>$qouteId, 'MobileNumber'=>$mobileNo, 'OTP'=>$otp, 'Amount'=>$amount); $response = $helper->getcurlDataArray($dataFormat,"username" => $merchant_user,"password" => $merchant_password, $adminUrl);




        1. Here I'm calling Helper function




        $response = $helper->getcurlDataArray($dataFormat,"username" => $merchant_user,"password" => $merchant_password, $adminUrl);




        1. Here is the Helper function




        public function getcurlDataArray($dataFormat,$username,$password,$service_url){

        $ch = curl_init($service_url);
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
        curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($dataFormat));
        curl_setopt($ch, CURLOPT_USERPWD, $username. ":" .$password);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
        $token = curl_exec($ch);
        if (curl_error($ch)) {
        $error_msg = curl_error($ch);
        $Errorhead = 'CurlError for Url:'.$service_url.' DataFormat:'.json_encode($dataFormat);
        $this->logError($Errorhead,$error_msg);
        }
        $response = json_decode($token,true);
        return $response;
        }





        share|improve this answer

















        1. This is the Data




        dataFormat = array('temp_order_id'=>$qouteId, 'MobileNumber'=>$mobileNo, 'OTP'=>$otp, 'Amount'=>$amount); $response = $helper->getcurlDataArray($dataFormat,"username" => $merchant_user,"password" => $merchant_password, $adminUrl);




        1. Here I'm calling Helper function




        $response = $helper->getcurlDataArray($dataFormat,"username" => $merchant_user,"password" => $merchant_password, $adminUrl);




        1. Here is the Helper function




        public function getcurlDataArray($dataFormat,$username,$password,$service_url){

        $ch = curl_init($service_url);
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
        curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($dataFormat));
        curl_setopt($ch, CURLOPT_USERPWD, $username. ":" .$password);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
        $token = curl_exec($ch);
        if (curl_error($ch)) {
        $error_msg = curl_error($ch);
        $Errorhead = 'CurlError for Url:'.$service_url.' DataFormat:'.json_encode($dataFormat);
        $this->logError($Errorhead,$error_msg);
        }
        $response = json_decode($token,true);
        return $response;
        }






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited yesterday









        magefms

        895220




        895220










        answered yesterday









        Umarfarooq GalibwaleUmarfarooq Galibwale

        715




        715

























            0














            dataFormat = array('temp_order_id'=>$qouteId, 'MobileNumber'=>$mobileNo, 'OTP'=>$otp, 'Amount'=>$amount); $response = $helper->getcurlDataArray($dataFormat,"username" => $merchant_user,"password" => $merchant_password, $adminUrl);




            1. Here I'm calling Helper function




            $response = $helper->getcurlDataArray($dataFormat,"username" => $merchant_user,"password" => $merchant_password, $adminUrl);




            1. Here is the Helper function




            public function getcurlDataArray($dataFormat,$username,$password,$service_url){

            $ch = curl_init($service_url);
            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
            curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($dataFormat));
            curl_setopt($ch, CURLOPT_USERPWD, $username. ":" .$password);
            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
            $token = curl_exec($ch);
            if (curl_error($ch)) {
            $error_msg = curl_error($ch);
            $Errorhead = 'CurlError for Url:'.$service_url.' DataFormat:'.json_encode($dataFormat);
            $this->logError($Errorhead,$error_msg);
            }
            $response = json_decode($token,true);
            return $response;





            share|improve this answer


























            • @divya sekar, Please check this code might be it will be helpful for u

              – Umarfarooq Galibwale
              yesterday











            • i will tried and update u @Umar

              – divya sekar
              yesterday











            • no i was getting a null value @umar

              – divya sekar
              yesterday
















            0














            dataFormat = array('temp_order_id'=>$qouteId, 'MobileNumber'=>$mobileNo, 'OTP'=>$otp, 'Amount'=>$amount); $response = $helper->getcurlDataArray($dataFormat,"username" => $merchant_user,"password" => $merchant_password, $adminUrl);




            1. Here I'm calling Helper function




            $response = $helper->getcurlDataArray($dataFormat,"username" => $merchant_user,"password" => $merchant_password, $adminUrl);




            1. Here is the Helper function




            public function getcurlDataArray($dataFormat,$username,$password,$service_url){

            $ch = curl_init($service_url);
            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
            curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($dataFormat));
            curl_setopt($ch, CURLOPT_USERPWD, $username. ":" .$password);
            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
            $token = curl_exec($ch);
            if (curl_error($ch)) {
            $error_msg = curl_error($ch);
            $Errorhead = 'CurlError for Url:'.$service_url.' DataFormat:'.json_encode($dataFormat);
            $this->logError($Errorhead,$error_msg);
            }
            $response = json_decode($token,true);
            return $response;





            share|improve this answer


























            • @divya sekar, Please check this code might be it will be helpful for u

              – Umarfarooq Galibwale
              yesterday











            • i will tried and update u @Umar

              – divya sekar
              yesterday











            • no i was getting a null value @umar

              – divya sekar
              yesterday














            0












            0








            0







            dataFormat = array('temp_order_id'=>$qouteId, 'MobileNumber'=>$mobileNo, 'OTP'=>$otp, 'Amount'=>$amount); $response = $helper->getcurlDataArray($dataFormat,"username" => $merchant_user,"password" => $merchant_password, $adminUrl);




            1. Here I'm calling Helper function




            $response = $helper->getcurlDataArray($dataFormat,"username" => $merchant_user,"password" => $merchant_password, $adminUrl);




            1. Here is the Helper function




            public function getcurlDataArray($dataFormat,$username,$password,$service_url){

            $ch = curl_init($service_url);
            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
            curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($dataFormat));
            curl_setopt($ch, CURLOPT_USERPWD, $username. ":" .$password);
            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
            $token = curl_exec($ch);
            if (curl_error($ch)) {
            $error_msg = curl_error($ch);
            $Errorhead = 'CurlError for Url:'.$service_url.' DataFormat:'.json_encode($dataFormat);
            $this->logError($Errorhead,$error_msg);
            }
            $response = json_decode($token,true);
            return $response;





            share|improve this answer















            dataFormat = array('temp_order_id'=>$qouteId, 'MobileNumber'=>$mobileNo, 'OTP'=>$otp, 'Amount'=>$amount); $response = $helper->getcurlDataArray($dataFormat,"username" => $merchant_user,"password" => $merchant_password, $adminUrl);




            1. Here I'm calling Helper function




            $response = $helper->getcurlDataArray($dataFormat,"username" => $merchant_user,"password" => $merchant_password, $adminUrl);




            1. Here is the Helper function




            public function getcurlDataArray($dataFormat,$username,$password,$service_url){

            $ch = curl_init($service_url);
            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
            curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($dataFormat));
            curl_setopt($ch, CURLOPT_USERPWD, $username. ":" .$password);
            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
            $token = curl_exec($ch);
            if (curl_error($ch)) {
            $error_msg = curl_error($ch);
            $Errorhead = 'CurlError for Url:'.$service_url.' DataFormat:'.json_encode($dataFormat);
            $this->logError($Errorhead,$error_msg);
            }
            $response = json_decode($token,true);
            return $response;






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited yesterday









            magefms

            895220




            895220










            answered yesterday









            Umarfarooq GalibwaleUmarfarooq Galibwale

            715




            715













            • @divya sekar, Please check this code might be it will be helpful for u

              – Umarfarooq Galibwale
              yesterday











            • i will tried and update u @Umar

              – divya sekar
              yesterday











            • no i was getting a null value @umar

              – divya sekar
              yesterday



















            • @divya sekar, Please check this code might be it will be helpful for u

              – Umarfarooq Galibwale
              yesterday











            • i will tried and update u @Umar

              – divya sekar
              yesterday











            • no i was getting a null value @umar

              – divya sekar
              yesterday

















            @divya sekar, Please check this code might be it will be helpful for u

            – Umarfarooq Galibwale
            yesterday





            @divya sekar, Please check this code might be it will be helpful for u

            – Umarfarooq Galibwale
            yesterday













            i will tried and update u @Umar

            – divya sekar
            yesterday





            i will tried and update u @Umar

            – divya sekar
            yesterday













            no i was getting a null value @umar

            – divya sekar
            yesterday





            no i was getting a null value @umar

            – divya sekar
            yesterday


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Magento Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f261724%2fcurl-api-return-blank-page-in-magento-2%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Polycentropodidae

            Magento 2 Error message: Invalid state change requested

            Paulmy