File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -140,15 +140,6 @@ public function __call($method, $params)
140140 }
141141
142142 // performs the HTTP POST
143- $ opts = array (
144- 'http ' => array (
145- 'method ' => 'POST ' ,
146- 'header ' => 'Content-type: application/json ' ,
147- 'content ' => $ request
148- )
149- );
150- $ context = stream_context_create ($ opts );
151-
152143 if ($ this ->enableCurl && is_callable ('curl_init ' )) {
153144 // use curl when available; solves problems with allow_url_fopen
154145 $ ch = curl_init ($ this ->url );
@@ -164,6 +155,15 @@ public function __call($method, $params)
164155 throw new \Exception ('Unable to connect to ' . $ this ->url );
165156 }
166157 } else {
158+ $ opts = array (
159+ 'http ' => array (
160+ 'method ' => 'POST ' ,
161+ 'header ' => 'Content-type: application/json ' ,
162+ 'content ' => $ request
163+ )
164+ );
165+ $ context = stream_context_create ($ opts );
166+
167167 if ($ fp = fopen ($ this ->url , 'r ' , false , $ context )) {
168168 $ response = '' ;
169169 while ($ row = fgets ($ fp )) {
You can’t perform that action at this time.
0 commit comments