Skip to content

Commit a939a64

Browse files
committed
fixed stuff
1 parent 3b52e1a commit a939a64

File tree

2 files changed

+3
-22
lines changed

2 files changed

+3
-22
lines changed

src/Request.php

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public static function send($url,$params=[],$type='GET',array $headers=[],$logge
3434
}
3535

3636
//request creator
37-
private static function createRequest($url,$type='GET',$params=[],$headers=[],$logger){
37+
private static function createRequest($url,$type='GET',$params=[],$headers=[],$logger=false){
3838

3939
$ch=curl_init($url);
4040

@@ -119,20 +119,7 @@ public static function sendRequestWithoutResponse($url,$type='get',$params=[],$h
119119

120120
//get host name
121121
public static function getHost(){
122-
$protocol=$_SERVER['SERVER_PROTOCOL'];
123-
if($protocol=='HTTP/1.1'){
124-
$protocol="http://";
125-
}elseif($protocol=='HTTPS/1.1'){
126-
$protocol="https://";
127-
}elseif($protocol=='HTTPS/2.1'){
128-
$protocol="https://";
129-
}elseif($protocol=='HTTPS/2.1'){
130-
$protocol="https://";
131-
}
132-
133-
$host=$_SERVER['HTTP_HOST'];
134-
135-
return $protocol.$host;
122+
return $_SERVER['HTTP_HOST'];
136123
}
137124

138125

@@ -200,10 +187,4 @@ private static function validType($reqtype){
200187

201188
}
202189

203-
204-
205-
206-
207-
208-
209190
}

test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
$headers=[
1313
'Content-Type'=>'application/json',
1414
];
15-
$logger=true; //enable or diable logging requests
15+
$logger=true; //enable or disable to logging requests
1616
$response=Request::send($url,$params,$method,$headers,$logger);
1717

1818
//show headers

0 commit comments

Comments
 (0)