I have a question about cURL. I am using cURL with this function:
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
Only this was causing an error: "Message: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set"
So I asked my hosting provider to fix this, and they did. But, and this is really stupid, they put a "curl" file in my bin directory. And I have no idea how to include this in my php script :S.
Never done it before, but can anybody help me. I am really stuck. I hope I posted enough info!
Tnx in advanced!
Tnx for all the great replies. But How would I fit "exec()" in this code?
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_TRANSFERTEXT, TRUE);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_URL, $articleUrl);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_MAXREDIRS, 5);
// grab URL and pass it to $grabArticle
$grabArticle = curl_exec($ch);
Edit 2: Oké, I almost got it working :). It is working just fine when I run it in putty, but in my php script nothing happens :(
I run this:
$grabArticle = exec('/home/twittern/bin/curl -L -m 30 -w url_effective --max-redirs 5 http://fok.nl/415758');
echo $grabArticle;
Any thing I am doing wrong?