1

I am using a free web hosting platform that disables the following php functions: allow_url_fopen, fsockopen, pfsockpen, getrusage, get_current_user, set_time_limit, getmyuid, getmypid, dl, leak, listen, chown, chgrp, realpath, link, exec, passthru, curl_init.

These functions being disabled means I can't use curl or fsockopen to communicate with an external server.

I have tried using file_get_contents as mentioned here, but I get the following error message: file_get_contents(): Unable to find the wrapper https - did you forget to enable it when you configured PHP?

Being that I'm on a free hosting plan, I don't know that I can do any php configuration. Are there any other options for communicating with an external server?

Community
  • 1
  • 1
Adam Johns
  • 32,040
  • 21
  • 108
  • 161
  • Which web hosting provider are you using ? Check on their website (on your admin panel if they give you one, as I guess so) if you can find anything about your php.ini file – ClmentM Aug 23 '13 at 19:43
  • I'm using awardspace.com. I haven't found anything about it, but I'll keep looking. – Adam Johns Aug 23 '13 at 19:44
  • have you tried using plain `http` instead of secure `https`? – dnet Aug 23 '13 at 19:45
  • Yes, without https it says network unreachable. It is a specific url to communicate with Google Cloud Messaging servers, so I believe it must be https. – Adam Johns Aug 23 '13 at 19:47

2 Answers2

2

It looks like you are either using a free account and that is a limitation of your host for non-paid accounts, or you have not requested them to enable outgoing communications on your paid account.

From the awardspace.com FAQ: (bolded area of interest)

15, I cannot use RSS feeds or cURL on my website?

The outgoing connections are disabled by default on all accounts, however they can be enabled for paid accounts upon request. So all you need to do is raise a ticket from your Hosting Control Panel -> Support Center -> Trouble Tickets and we will enable them for you.

Michael Irigoyen
  • 21,233
  • 17
  • 82
  • 125
  • Thanks for the answer. I didn't see that in the FAQ. Looks like I am out of luck. I'll probably start researching good paid options now. – Adam Johns Aug 23 '13 at 20:02
2

file_get_contents is probably your best option. Depending on the permissions you get as a free user, you can try setting php.ini from the code, which only persists for that one script.

See http://php.net/manual/en/function.ini-set.php

So, to work around the Unable to find the wrapper https error, you can try

ini_set('extension', 'php_openssl.dll');
ini_set('allow_url_include', 'on');
LS97
  • 336
  • 5
  • 15
  • Thanks for the answer. Unfortunately I found the mention that free accounts cannot edit php.ini. – Adam Johns Aug 23 '13 at 20:00
  • I used to use a free host (I now switched to paid, which is so much better for developing, but that's not the point) that didn't allow me to edit php.ini, but did allow me to set certain options via ini_set that would only last for that particular page query. It's worth a try, although I doubt they will let you change the extension parameter. – LS97 Aug 23 '13 at 20:04
  • Yeah, unfortunately ini_set didn't work either. Thanks for answering though. – Adam Johns Aug 23 '13 at 20:18