@@ -1662,19 +1662,36 @@ public static function isWindowsServer() {
1662
1662
1663
1663
/**
1664
1664
* gets the data from a URL
1665
+ *
1666
+ * On Windows you need php curl extension + php in PATH
1667
+ * https://www.howtosolutions.net/2021/09/fixing-php-curl-extension-not-loading-when-enabled-windows/
1668
+ *
1669
+ * @param string $url
1670
+ * @param int $timeout in seconds
1671
+ * @return FALSE on failure, result on success
1665
1672
*/
1666
1673
public static function getUrlContent ($ url , $ timeout = 5 ) {
1667
1674
$ ch = curl_init ();
1668
1675
curl_setopt ($ ch , CURLOPT_URL , $ url );
1669
1676
curl_setopt ($ ch , CURLOPT_TIMEOUT , $ timeout );
1670
1677
curl_setopt ($ ch , CURLOPT_RETURNTRANSFER , 1 );
1671
1678
curl_setopt ($ ch , CURLOPT_FOLLOWLOCATION , 1 );
1679
+ #curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
1672
1680
1673
1681
if (!empty (Constants::$ proxy )) {
1674
1682
curl_setopt ($ ch , CURLOPT_PROXY , Constants::$ proxy );
1675
1683
#curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, TRUE);
1676
1684
}
1677
1685
$ data = curl_exec ($ ch );
1686
+
1687
+ if (FALSE === $ data ) {
1688
+ if (false == extension_loaded ("curl " )) {
1689
+ self ::$ logger ->error ("getUrlContent(): PHP curl extension missing ! " );
1690
+ }
1691
+ self ::$ logger ->error ("getUrlContent( $ url) " );
1692
+ //$msg = var_export(curl_getinfo($ch), true);
1693
+ //self::$logger->error("$msg");
1694
+ }
1678
1695
curl_close ($ ch );
1679
1696
return $ data ;
1680
1697
}
0 commit comments