Alternative for HTTPRequest in php -


I am using the HttpRequest class in my php script, but when I upload this script to my hosting provider's server I'm having a fatal error while executing this:

Fatal error: Class 'HTPRAEEST' did not get in ... On line 87

I believe the reason for this It is that my hosting provider's php.ini configuration includes an extension supporting HttpRequest When I contacted him, he said that we can not establish the following expansion on sharing hosting. So I want the option of httpRequest that I do it:

  $ url = http: // ip: 8080 / folder / suspendseubscriber? SubscriberId = $ 5 $ data_string = ""; $ Request = new HTTPRequest ($ url, HTTP_METH_POST); $ Request & gt; SetRawPostData ($ data_string); $ Request & gt; Send (); $ Response = $ request- & gt; GetResponseBody (); $ Response = json_decode ($ response, true); Return $ Reaction;   

Or how can I use this request in curl because it is not working for blanketstraking?

You can use curl in php like this:

  $ ch = curl_init ($ url); $ Data_string = ""; Curl_setopt ($ CH, CURLOPT_POSTFIELDS, $ data_string); Curl_setopt ($ ch, CURLOPT_HTTPHEADER, array ('content-type: application / jason')); Curl_setopt ($ CH, CURLOPT_RETURNTRANSFER, true); $ Result = curl_xac ($ CH); Curl_close ($ ch); Return result;   

And the empty data string is not understood in the post request, but I checked it with the empty data string and it works quietly.

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -