AriusII Posted February 12, 2020 Share Posted February 12, 2020 Hello, I have a fix ip with port open ect ... ( 80 - 5400 ) I have my Intersect Server ( IS * ) on my windows deskop ( 192.168.0.10 [ Api : http://localhost:5400 ] ) My webserver is hosted by my BOX in a ubuntu VM ( 192.168.0.180 )@jcsnider say me to go : here https://stackoverflow.com/questions/6213509/send-json-post-using-php I followed the two average solution, and one with CURL, but, it dosn't work... i creat an oauth.php Quote <?PHP $url = "http://192.168.0.10:5400/api/oauth/token"; $data = array ( 'grant_type' => 'password', 'username' => 'AriusII', 'password' => '3964E32D361C9E6F1813196A25D2BA5E2BE435146588FAAAE09E58EAB704239D' ); $content = json_encode($data); $curl = curl_init($url); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-type: application/json")); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $content); $json_response = curl_exec($curl); $status = curl_getinfo($curl, CURLINFO_HTTP_CODE); if ( $status != 201 ) { die("Error: call to URL $url failed with status $status, response $json_response, curl_error " . curl_error($curl) . ", curl_errno " . curl_errno($curl)); } curl_close($curl); $response = json_decode($json_response, true); ?> Expand Link to comment Share on other sites More sharing options...
1 jcsnider Posted February 12, 2020 Share Posted February 12, 2020 Undo the changes to your PHP file. Change the line back to: $url = "http://192.168.0.10:5400/api/oauth/token"; Edit your server api config file, change the hostname to: "Hosts": [ "http://*:5400" ], Run your server as administrator so windows will allow it to bind that port, if it gives you an error change the port to 5402. It should work after that. AriusII 1 Link to comment Share on other sites More sharing options...
1 AriusII Posted February 12, 2020 Author Share Posted February 12, 2020 On 2/12/2020 at 10:28 PM, jcsnider said: Undo the changes to your PHP file. Change the line back to: $url = "http://192.168.0.10:5400/api/oauth/token"; Edit your server api config file, change the hostname to: "Hosts": [ "http://*:5400" ], Run your server as administrator so windows will allow it to bind that port, if it gives you an error change the port to 5402. It should work after that. Expand £Yeah ! It's that i don't have thinked about a Port conflict ! THANKS Link to comment Share on other sites More sharing options...
0 jcsnider Posted February 12, 2020 Share Posted February 12, 2020 What error or errors do you receive? Link to comment Share on other sites More sharing options...
0 AriusII Posted February 12, 2020 Author Share Posted February 12, 2020 I get this : Link to comment Share on other sites More sharing options...
0 jcsnider Posted February 12, 2020 Share Posted February 12, 2020 Share your server/resources/config/api config file Link to comment Share on other sites More sharing options...
0 AriusII Posted February 12, 2020 Author Share Posted February 12, 2020 Quote { "RouteAuthorization": {}, "Hosts": [ "http://localhost:5400" ], "Cors": [], "DataProtectionKey": "EA478F6EA89DFDC752B29460A2E0B42D05AA6D6D65EBC35A38426D0EEACE8D79", "Enabled": true, "DebugMode": false, "SeedMode": false, "RefreshTokenLifetime": 15 } Expand I only have one account, and yeah he have the APi Right ( with the api account true ) Link to comment Share on other sites More sharing options...
0 jcsnider Posted February 12, 2020 Share Posted February 12, 2020 Maybe try this: http://phaeniom.freeboxos.fr:5400 instead of http://192.168.0.10:5400 in your php script? Link to comment Share on other sites More sharing options...
0 AriusII Posted February 12, 2020 Author Share Posted February 12, 2020 it's don't work and when i edit my ' localhost:5400 ' ( it'sm y 192.168.0.10 ) and edit it with my external ip ( 82.64.190.33:5400) Failed to start API. 2020-02-12 21:32:32.504 [Error] Failed to start API. System.Reflection.TargetInvocationException: Une exception a été levée par la cible d'un appel. ---> System.Net.HttpListenerException: Accès refusé à System.Net.HttpListener.AddAllPrefixes() à System.Net.HttpListener.Start() à Microsoft.Owin.Host.HttpListener.OwinHttpListener.Start(HttpListener listener, Func`2 appFunc, IList`1 addresses, IDictionary`2 capabilities, Func`2 loggerFactory) à Microsoft.Owin.Host.HttpListener.OwinServerFactory.Create(Func`2 app, IDictionary`2 properties) --- Fin de la trace de la pile d'exception interne --- à System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) à System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) à System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) à Microsoft.Owin.Hosting.ServerFactory.ServerFactoryAdapter.Create(IAppBuilder builder) à Microsoft.Owin.Hosting.Engine.HostingEngine.Start(StartContext context) à Intersect.Server.Web.RestApi.RestApi.Start() dans C:\Users\JC Snider\Desktop\AGD\Intersect-Engine\Intersect.Server\Web\RestApi\RestApi.cs:ligne 71 Link to comment Share on other sites More sharing options...
0 jcsnider Posted February 12, 2020 Share Posted February 12, 2020 Don't change the api config file in the server, it is good. Change your php script to $url = "http://phaeniom.freeboxos.fr:5400/api/oauth/token"; Link to comment Share on other sites More sharing options...
0 AriusII Posted February 12, 2020 Author Share Posted February 12, 2020 Done it, and don't work, same if i do http://phaeniom.freeboxos.fr:5400/api/oauth/token i don't have {"error":"grant_type_missing"} like what i do with my localhost Link to comment Share on other sites More sharing options...
Question
AriusII
Hello,
I have a fix ip with port open ect ... ( 80 - 5400 )
I have my Intersect Server ( IS * ) on my windows deskop ( 192.168.0.10 [ Api : http://localhost:5400 ] )
My webserver is hosted by my BOX in a ubuntu VM ( 192.168.0.180 )
@jcsnider say me to go : here https://stackoverflow.com/questions/6213509/send-json-post-using-php
I followed the two average solution, and one with CURL, but, it dosn't work...
i creat an oauth.php
Link to comment
Share on other sites
10 answers to this question
Recommended Posts