Page 1 of 1

cURL

Posted: 12 Dec 2006, 03:47
by Dragon45
Does anyone have experience with this over-featured piece of garbage? The Smug Goat home barn (http://www.smuggoat.net) has to use cURL to work with any sort of image/file loading because the host has disabled regular file stream access (dreamhost.com is the host), and I have to type another 50 lines of code per standard PHP file_get_contents function.

It's a pain in the ass and it's definitely getting in the way of setting up the damn image gallery.


WTF draemhost.

u phail.

So yeh, help would be appreciated.

Posted: 12 Dec 2006, 08:42
by Ishach
run ur boy

Posted: 12 Dec 2006, 09:57
by hawkki
Ishach wrote:run ur boy
Already here? nooo way!

Posted: 12 Dec 2006, 12:54
by iamacup
so fopen doesent work at all, or only on remote urls?

ive always used curl with fopen, like this

curl

Code: Select all

<?php
$handle = curl_init("http://www.example.com/");
$file = fopen("index.html", "w");

curl_setopt($handle, CURLOPT_FILE, $file);
curl_setopt($handle, CURLOPT_HEADER, 0);

curl_exec($handle);
curl_close($handle);
fclose($file);
?> 

fopen

Code: Select all

<?php

$handle = fopen("http://www.example.com/index.html", "rb");
$contents = '';

while (!feof($handle)) 
  {
    $contents .= fread($handle, 8192);
  }
fclose($handle);

?>
you could also try

Code: Select all

<?php
INI_SET("allow_url_fopen", 1);
?>
if they have crappeh admins who didnt change the httpd.conf to dissalow changes to it :P.