PHP cURL starts giving error 100 -


I have created a common method in php to handle all my requests against an API. I have a problem that I can not understand. I have made some requests against the API and have started giving error code 100 to wait for about 3 minutes. And as long as I do not restart the API service (Grizzly, build on Java) it continues.

Is there any curl configuration in my method that can be wrong?

Thanksgiving method for any help looks like this:

  / ** * This function will handle all server requests * @PRAM $ requestpath string fixed this variable That's the string session of $ @ POST, POST, POST, PUT, DELETE, OPTIONS * @ PRAM $ DATAERA ARA data which will be sent to Android * @ The ultimate $ session on End if the user is logged in session. * @Return Array will return the array based on the JSN response from the server / public static function SendRequest ($ requestpath, $ method, $ dataArray, $ session = zero) {/ * import configuration * / $ configRest_Security = Config :: security ( ); / * Create Request URL / $ url = "https: // Local Host: 6010 /". $ Requestpath; / * Provide Public Key * / $ public key = $ configRest_Security ["PublicKeyPKCS8"]; / * Encody each array value and add them to url path * / foreach ($ data array $ value) {$ url = $ url "/". Rawurlencode (StripSlash ($ value)); } $ Ch = curl_init (); / * Set URI for request * / curl_setopt ($ ch, CURLOPT_URL, $ url); / * Set the method of this request / ($ method == "post") {curl_setopt ($ ch, CURLOPT_POST, true); } Otherwise ($ method == "PUT") {curl_setopt ($ ch, CURLOPT_PUT, true); } Otherwise ($ method == "delete") {curl_setopt ($ ch, CURLOPT_CUSTOMREQUEST, $ method); } Otherwise ($ method == "options") {curl_setopt ($ ch, CURLOPT_CUSTOMREQUEST, $ method); } / * If the session was established, send it with the request / / (if empty ($ session)) {$ authentication = "Basic". Sefer :: Encrypt ($ session. ":". (Time () + 5)); } And {$ authentication = "none"; } / * Create an HTTP header * / $ header = array ("Accept: Application / Jason", "Accept-charset: UTF-8", "Content-Length: 0", "Content-Type: Application / x -www -form-urlencoded "," X-public: ". $ Public key," authorization: ". $ Authentication,); Set HTTP header to / * cURL * / curl_setopt ($ CH, CURLOPT_HTTPHEADER, $ header); / * Set timeout * / curl_setopt ($ ch, CURLOPT_TIMEOUT, 4); / * Fetch answer * / curl_statease ($ CH, CURLOPT_RETURNTRANSFER, true); / * Do not check the self signed certificate / curl_setopt ($ CH, CURLOPT_SSL_VERIFYPEER, FALSE); Curl_setopt ($ CH, CURLOPT_SSL_VERIFYHOST, FALSE); / * Execute curl command / $ $ result = curl_exec ($ ch); $ HttpReturnCode = curl_getinfo ($ CH, CURLINFO_HTTP_CODE); If ($ httpReturnCode! = 200) {echo "HTTP error:" $ httpReturnCode; } Curl_close ($ ch); Return json_decode ($ result, true); }  


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -