@@ -183,35 +183,47 @@ public function call($module, $function, $args = array())
183
183
184
184
curl_close ($ curl );
185
185
186
+ $ curl_response_decoded = json_decode ($ curl_res );
187
+
186
188
$ response ['inputs ' ]['url ' ] = $ url ;
189
+
187
190
$ response ['curl_response ' ] = [
191
+ 'curl_response ' => $ curl_res ,
192
+ 'curl_response_decoded ' => $ curl_response_decoded ,
188
193
'header_size ' => $ header_size ,
189
194
'header ' => $ header ,
190
- 'response ' => $ curl_res ,
191
195
'body ' => $ body ,
192
196
'error ' => $ err ,
193
197
'err_no ' => $ err_no ,
194
198
];
195
199
200
+
201
+
196
202
if ($ err || $ err_no ) {
197
203
198
204
$ response ['status ' ] = 'failed ' ;
199
205
$ response ['errors ' ] = $ err ;
200
206
201
- } else {
202
-
203
- if (isset ($ res ) && isset ($ res ->status ) && $ res ->status == 0 )
204
- {
205
- $ response ['status ' ] = 'failed ' ;
206
- $ response ['errors ' ][] = $ res ->errors ;
207
- $ response ['inputs ' ]['url ' ] = $ url ;
208
- } else
209
- {
210
- $ response ['data ' ] = json_decode ($ curl_res );
211
- $ response ['status ' ] = 'success ' ;
212
- $ response ['inputs ' ]['url ' ] = $ url ;
213
- }
207
+ } if (isset ($ curl_response_decoded ->errors ) && count ($ curl_response_decoded ->errors ) > 0 )
208
+ {
209
+ $ response ['status ' ] = 'failed ' ;
210
+ $ response ['errors ' ] = $ curl_response_decoded ->errors ;
211
+
212
+ } else {
213
+
214
+ if (isset ($ res ) && isset ($ res ->status ) && $ res ->status == 0 )
215
+ {
216
+ $ response ['status ' ] = 'failed ' ;
217
+ $ response ['errors ' ][] = $ res ->errors ;
218
+ $ response ['inputs ' ]['url ' ] = $ url ;
219
+ } else
220
+ {
221
+ $ response ['data ' ] = json_decode ($ curl_res );
222
+ $ response ['status ' ] = 'success ' ;
223
+ $ response ['inputs ' ]['url ' ] = $ url ;
214
224
}
225
+ }
226
+
215
227
216
228
return $ response ;
217
229
}
0 commit comments