mirror of
https://github.com/gtbu/Typesetter-5.3-p8.git
synced 2024-11-21 13:59:11 +01:00
Remoteget - Problem with localhost
With Xamm and similar : fopen(): php_network_getaddresses: getaddrinfo for www.localhost failed: Host ist unknown
This commit is contained in:
parent
57df8affcf
commit
55e213af23
1 changed files with 6 additions and 7 deletions
|
@ -174,19 +174,21 @@ namespace gp\tool{
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetch a url using php's stream_get_contents() function
|
||||
*
|
||||
*/
|
||||
public function stream_request($url,$r){
|
||||
|
||||
$parsedUrl = parse_url($url);
|
||||
if ($parsedUrl['host'] == 'localhost' || $parsedUrl['host'] == 'www.localhost') {
|
||||
$url = str_replace(['http://www.localhost', 'http://localhost'], 'http://127.0.0.1', $url);
|
||||
$url = str_replace(['https://www.localhost', 'https://localhost'], 'https://127.0.0.1', $url);
|
||||
}
|
||||
|
||||
$arrContext = $this->stream_context($url,$r);
|
||||
|
||||
$context = stream_context_create($arrContext);
|
||||
|
||||
$handle = fopen($url, 'r', false, $context);
|
||||
|
||||
if( $handle === false ){
|
||||
static::$debug['stream'] = 'no handle';
|
||||
return false;
|
||||
|
@ -199,13 +201,10 @@ namespace gp\tool{
|
|||
fclose($handle);
|
||||
|
||||
$processedHeaders = static::processHeaders($theHeaders);
|
||||
|
||||
$this->body = static::chunkTransferDecode($strResponse,$processedHeaders);
|
||||
|
||||
return $this->ReturnRequest( $url, $r, $processedHeaders );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create context array
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue