|
dolibarr 23.0.3
|
This file contains functions dedicated to get URLs. More...
Go to the source code of this file.
Functions | |
| getURLContent ($url, $postorget='GET', $param='', $followlocation=1, $addheaders=array(), $allowedschemes=array('http', 'https'), $localurl=0, $ssl_verifypeer=-1, $timeoutconnect=0, $timeoutresponse=0, $otherCurlOptions=array()) | |
| Function to get a content from an URL (use proxy if proxy defined). | |
| isIPAllowed ($iptocheck, $localurl) | |
| Is IP allowed. | |
| getDomainFromURL ($url, $mode=0) | |
| Function get second level domain name. | |
| getRootURLFromURL ($url) | |
| Function root url from a long url For example: https://www.abc.mydomain.com/dir/page.html return 'https://www.abc.mydomain.com' For example: https://www.abc.mydomain.com/ return 'https://www.abc.mydomain.com' For example: http://www.abc.mydomain.com/ return 'http://www.abc.mydomain.com'. | |
| removeHtmlComment ($content) | |
| Function to remove comments into HTML content. | |
This file contains functions dedicated to get URLs.
Definition in file geturl.lib.php.
| getDomainFromURL | ( | $url, | |
| $mode = 0 ) |
Function get second level domain name.
For example: https://www.abc.mydomain.com/dir/page.html returns 'mydomain' with mode 0, 'mydomain.om' with mode 1, 'abc.mydomain.com' with mode 2. For example: part1.nosp@m.@myd.nosp@m.omain.nosp@m..com returns 'mydomain.com' with mode 1
| string | $url | Full URL or Email. |
| int | $mode | 0=return 'mydomain', 1=return 'mydomain.com', 2=return 'abc.mydomain.com' |
Definition at line 440 of file geturl.lib.php.
Referenced by SMTPs\_server_authenticate(), and SMTPs\sendMsg().
| getRootURLFromURL | ( | $url | ) |
Function root url from a long url For example: https://www.abc.mydomain.com/dir/page.html return 'https://www.abc.mydomain.com' For example: https://www.abc.mydomain.com/ return 'https://www.abc.mydomain.com' For example: http://www.abc.mydomain.com/ return 'http://www.abc.mydomain.com'.
| string | $url | Full URL. |
Definition at line 495 of file geturl.lib.php.
Referenced by getAllImages().
| getURLContent | ( | $url, | |
| $postorget = 'GET', | |||
| $param = '', | |||
| $followlocation = 1, | |||
| $addheaders = array(), | |||
| $allowedschemes = array('http', 'https'), | |||
| $localurl = 0, | |||
| $ssl_verifypeer = -1, | |||
| $timeoutconnect = 0, | |||
| $timeoutresponse = 0, | |||
| $otherCurlOptions = array() ) |
Function to get a content from an URL (use proxy if proxy defined).
Support Dolibarr setup for timeout (MAIN_USE_*_TIMEOUT) and proxy (MAIN_PROXY_*) Enhancement of CURL to add an anti SSRF protection:
You can enable constant MAIN_CURL_DEBUG to get detail of output/input into dolibarr_curl.log file.
| string | $url | URL to call. |
| 'POST'|'GET'|'HEAD'|'PUT'|'PATCH'|'PUTALREADYFORMATED'|'POSTALREADYFORMATED'|'PATCHALREADYFORMATED'|'DELETE' | $postorget 'POST', 'GET', 'HEAD', 'PUT', 'PATCH', 'PUTALREADYFORMATED', 'POSTALREADYFORMATED', 'PATCHALREADYFORMATED', 'DELETE' | |
| string|array<mixed,mixed> | $param Parameters of URL (x=value1&y=value2 urlencoded even with POST) or may be a formatted content with $postorget='POSTALREADYFORMATED/PUTALREADYFORMATED' | |
| int<0,1> | $followlocation 0=Do not follow, 1=Follow location. | |
| string[] | $addheaders | Array of string to add into header. Example: ('Accept: application/xrds+xml', ....) |
| string[] | $allowedschemes | List of schemes that are allowed ('http' + 'https' only by default) |
| int<0,2> | $localurl 0=Only external URL are possible, 1=Only local URL, 2=Both external and local URL are allowed. | |
| int<-1,1> | $ssl_verifypeer -1=Auto (no ssl check on dev, check on prod), 0=No ssl check, 1=Always ssl check | |
| int | $timeoutconnect | Timeout for connection time |
| int | $timeoutresponse | Timeout for total time including connection |
| array<int,mixed>|null | $otherCurlOptions Array of other curl options to set. Example: array(CURLOPT_SSL_VERIFYPEER => false) |
Definition at line 48 of file geturl.lib.php.
References dol_syslog(), getDolGlobalInt(), getDolGlobalString(), and isIPAllowed().
Referenced by RedditHandler\authenticate(), ExternalModules\callApi(), MailmanSpip\callMailman(), check_user_password_openid_connect(), PartnershipUtils\checkDolibarrBacklink(), DiasporaHandler\fetch(), RedditHandler\fetch(), Ai\generateContent(), getAllImages(), Setup\getCheckIntegrity(), GoogleAPI\getGeoCoordinatesOfAddress(), SimpleOpenID\GetOpenIDServer(), ExternalModules\getRemoteYamlFile(), RssParser\parser(), PriceGlobalVariableUpdater\process(), ICal\read_file(), InterfaceWebhookTriggers\runTrigger(), and MultiCurrency\syncRates().
| isIPAllowed | ( | $iptocheck, | |
| $localurl ) |
Is IP allowed.
| string | $iptocheck | IP to check |
| int | $localurl | 0=external url only, 1=internal url only |
Definition at line 383 of file geturl.lib.php.
References getDolGlobalString().
Referenced by getURLContent().
| removeHtmlComment | ( | $content | ) |
Function to remove comments into HTML content.
| string | $content | Text content |
Definition at line 506 of file geturl.lib.php.