b.prisera Posted May 2, 2007 Share Posted May 2, 2007 Hello, I have a very stupid question I guess Wink I built my own website a year ago, when I started with PHP. It works quite fine but, as I don't improve my PHP skills, I don't keep my knowledge up-to-date. It happened to me a few weeks ago that my Guestbook ('outsourced' by a free guestbook provider) stopped viewing. It took me a really long time to find out why, but after loads of questions I found out that my webhosting provider doesn't support the url_fopen function any more whilst my 'outsorcer' recommends it. The hosting provider only wrote me, 'we don't allow this any more, use curl function instead'. Please, I'm sure it's really easy, but I've been searching the websites in my language (Czech) and haven't found any curl tutorial place to learn from until I found your website. Please, could someone help me to convert this code to a curl code they require? I would be very very grateful! Cheers :-) This is the code that the 'free-guestbook-services' website recommends to be included in the source code. I need to replace this with curl: if (ereg("msie", strtolower($_SERVER['HTTP_USER_AGENT'])) AND !ereg("opera", strtolower($_SERVER['HTTP_USER_AGENT']))){ $ie=1; } include("http://vsevjednom.cz/guestbook.php?gb=1248&odpoved=".$_GET['odpoved']."&gb_pg=" .$_GET['gb_pg']."&hledat=".$_GET['hledat']."&ie=".$ie);} Thanks, thanks, thanks!!! :-) Lucie (http://www.nikk.cz) Quote Link to comment Share on other sites More sharing options...
btherl Posted May 2, 2007 Share Posted May 2, 2007 Here is a curl function to fetch a url: function fetch_url($url) { $ch = curl_init($url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_FAILONERROR, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); $content = curl_exec($ch); return $content; } You should probably use it like this: echo fetch_url("http://vsevjednom.cz/guestbook.php?gb=1248&odpoved=".$_GET['odpoved']."&gb_pg=" .$_GET['gb_pg']."&hledat=".$_GET['hledat']."&ie=".$ie); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.