1
$url = "http://api.abc.com/";
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_HTTPHEADER, array(
            'accept: application/json'
        ));
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
        curl_getinfo($ch);
        $response = curl_exec($ch);
        curl_close($ch);
        $response; 
        $this->configWriter->save('grazz_auth/graz_settings/expiry_date', $response);

This is saving on the second time submit on save config button. Not working on first save.

Any idea?

Thanks

2
  • please go through the error log an share the details if there is any?
    – Pramod
    Dec 31, 2019 at 13:14
  • What is the method you are using for this action? Can you update your code to the question? Jan 2, 2020 at 7:42

1 Answer 1

0

replace your code from :

$response = curl_exec($ch);
curl_close($ch);
$response; 
$this->configWriter->save('grazz_auth/graz_settings/expiry_date', $response);

to

$response = curl_exec($ch);     
$response; 
$this->configWriter->save('grazz_auth/graz_settings/expiry_date', $response);
curl_close($ch);
5
  • This is not working
    – Shomita
    Jan 1, 2020 at 14:08
  • have you sure that, you get value first time from that one? Jan 1, 2020 at 14:11
  • I am not getting value first time
    – Shomita
    Jan 1, 2020 at 14:12
  • Have you try to debug the code? Does where it wrong the first time. Jan 2, 2020 at 4:46
  • Actually when I click second time submit config then i get the response value not on first time
    – Shomita
    Jan 2, 2020 at 4:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.