I have a simple PHP function on a friend server that I have checked and PHP cURL is enabled
< P> function: function sw_fetch_code ($ apikey = '', $ email = '') {$ url = "http://www.domain.com /xxx/api.php ? Getcode = 1 & apikey = ". $ Apikey." & Amp; email = ". $ Email" ". $ Ch = curl_init (); Curl_setopt ($ CH, CURLOPT_URL, $ url); Curl_setopt ($ CH, CURLOPT_RETURNTRANSFER, 1); Curl_setopt ($ CH, CURLOPT_HEADER, 1); $ Result = curl_xac ($ CH); Curl_close ($ ch); $ Obj = json_decode ($ result); If (! $ Obj)) {if ($ obj-> status == 200) {Refund $ obj- & gt; Code; } And {refund $ obj- & gt; Event; }}}
As you can see it is very simple and I have tested it and works on the local host and returns the URL as the internal expected from my own server
Any thoughts that can be caused by this?
First of all: if "URL" works then check with "friend" server because you have There is no post parameter, you can check with exact inquiries and get expected results. See whether you can get results on the browser on the browser server. If you do not have a GUI then try wget on the command line. If you get results, see if you go to the next step, if you do not curl, then there is no problem "friend server" is not able to see your domain. Network issues / hosts etc. (More if that is the case)
Second: If you see the result at step 1. Try it out and see if you get something:
$ handle = fopen ($ url, "rb"); $ Content = ''; While (! Fieff ($ handle)) {$ contents = Fread ($ Handle, 1024); }
If you get the answer, then something wrong with curl
Comments
Post a Comment