View Single Post
Old 01-07-2013, 01:34 PM   PM User | #2
Redcoder
Regular Coder

 
Redcoder's Avatar
 
Join Date: May 2012
Location: /dev/couch
Posts: 309
Thanks: 2
Thanked 46 Times in 45 Posts
Redcoder has a little shameless behaviour in the past
If you are using Windows and a server like Wamp or Xampp, there are also some bugs that are in combination of Windows, file_get_contents() and localhost that are not going to be fixed. Use cURL instead. file_get_contents has some php.ini values set off by default.

https://bugs.php.net/bug.php?id=38826
https://bugs.php.net/bug.php?id=40881

Use cURL. Off course you have to enable it if its not enabled but it most probably is.
PHP Code:
$file_path_str "http://localhost/pathtofile";

$ch curl_init();

curl_setopt($chCURLOPT_URL''.$file_path_str.'');
curl_setopt($chCURLOPT_HTTPGET1);
curl_setopt ($chCURLOPT_HEADER0);
curl_setopt ($chCURLOPT_USERAGENTsprintf("Mozilla/%d.0",rand(4,5)));
curl_setopt($chCURLOPT_FOLLOWLOCATION1);
curl_setopt($chCURLOPT_MAXREDIRS10);
curl_setopt($chCURLOPT_RETURNTRANSFER1);

$curl_response_res curl_exec ($ch);
curl_close ($ch); 
Also remember, Apache in Windows by default can't access files outside www or htdocs folder.
__________________
For professional Hosting and Web design.....


NetEssentials.co.uk
Redcoder is offline   Reply With Quote