Jump to content

Help With Curl


robinbell

Recommended Posts

Hi,I have an application I am testing by writing a log file with variable values at various critical points in the application process, using the PHP file_put_contents function. This works fine on my computer, where I am running PHP5, IIS and MySQL. However, I am having problems trying to duplicate an intermittent error and moved the application to my ISP's serverHowever, when I run the app on that server, I get the following error message:Fatal error: Call to undefined function: file_put_contents() in /customers/robinbell.se/robinbell.se/httpd.www/PHPFiles/chat_files/send_text.php on line 29When I queried support, I was told that this PHP function is not activated on their server, and I should use CURL instead. Being new to all this, I haven't heard of CURL...Can anyone give me some clues as to how I can use CURL to replace my use of the PHP file_put_contents function?Thanks anyone for help

Link to comment
Share on other sites

file_put_contents is only defined in PHP 5, not PHP 4. So either your host is still using PHP 4, or they specifically disable file_put_contents. If you set up a phpinfo page you can check on both of those:<?phpphpinfo();?>This is a problem they should fix. PHP 5 has been stable since 7-2004, so by now it's 4 and a half years old. PHP 4 at this point is almost 9 years old. They need to be using PHP 5 if they aren't already. If they aren't, tell them you need your account changed to PHP 5 and that if they can't do that then you'll find another host (if you aren't paying for your hosting space, then.. well, you get what you pay for).In the meantime, file_put_contents is a shortcut for fopen/fwrite/fclose. If they are blocking file_put_contents, they would also block fopen probably.Also:http://www.php.net/manual/en/book.curl.php

Link to comment
Share on other sites

Thanks again. I checked my ISP and they're running PHP 4.4.9. I'll try to persuade them to upgrade to PHP5, but in the meantime it seems that I can use fopen, fwrite and fclose - at least I get no errors when I run those, but I haven't been able to find my output file yet. I assumed that it would create the file in the same directory as the PHP script (as it does on my computer) but it doesn't appear there on my web server. Another mystery of life to solve.Looks like I have a mass of reading to do about CURL. Thanks for the link

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...