Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CP | Avisos failed with error 0 #2397

Closed
FJSFerreira opened this issue Dec 31, 2021 · 3 comments · Fixed by #2403
Closed

CP | Avisos failed with error 0 #2397

FJSFerreira opened this issue Dec 31, 2021 · 3 comments · Fixed by #2403

Comments

@FJSFerreira
Copy link

Error message: Unexpected response from upstream. cUrl error: SSL certificate problem: unable to get local issuer certificate (60) PHP error:
Query string: action=display&bridge=ComboiosDePortugal&format=Html
Version: dev.2021-04-25

@em92
Copy link
Contributor

em92 commented Jan 1, 2022

Ping @somini as maintainer of this bridge

@dvikan
Copy link
Contributor

dvikan commented Jan 2, 2022

The problem is that www.cp.pt is not sending a complete certificate chain. They should include the intermediate ca cert "Sectigo RSA Domain Validation Secure Server CA" but they are not. I sent them a message regarding this.

Until they fix the issue from their side there are temporary solutions:

  1. Add the ca cert manually. Download the cert from https://support.sectigo.com/articles/Knowledge/Sectigo-Intermediate-Certificates and drop it into /usr/local/share/ca-certificates and run sudo update-ca-certificates

  2. Disable certificate validation in the curl call:

diff --git a/bridges/ComboiosDePortugalBridge.php b/bridges/ComboiosDePortugalBridge.php
index 610e23b..d6b0ac3 100644
--- a/bridges/ComboiosDePortugalBridge.php
+++ b/bridges/ComboiosDePortugalBridge.php
@@ -7,7 +7,9 @@ class ComboiosDePortugalBridge extends BridgeAbstract {
        const MAINTAINER = 'somini';
 
        public function collectData() {
-               $html = getSimpleHTMLDOM($this->getURI() . '/consultar-horarios/avisos')
+               $html = getSimpleHTMLDOM($this->getURI() . '/consultar-horarios/avisos', [], [
+            CURLOPT_SSL_VERIFYPEER => 0,
+        ])
                        or returnServerError('Could not load content');

@somini
Copy link
Contributor

somini commented Jan 4, 2022

@dvikan Thanks for that, I can send a Merge Request with that small change.

It works on Firefox, I thought the browsers used the same certificates list?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants