Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Curl - pobieranie plikow, access denied to the fileder
JakubBab
post
Post #1





Grupa: Zarejestrowani
Postów: 96
Pomógł: 2
Dołączył: 13.07.2015

Ostrzeżenie: (0%)
-----


Czesc,

Zaczalem bawic sie cUrlem. Napisalem funkcje ktora by pobrala mi obrazy ze strony. Problem taki, ze dostaje

fopen(C:/xampp/htdocs/testmenow): failed to open stream: Permission denied.

Poczytalem na forach i jest napisane, zebym zmienil permission type w chmod na 777. Z drugiej strony czytalem opinie, zeby sie wstrzymac od takich akcji.

Jakies rady jak to rozwiazac?

  1. function saveImage($urlImage){
  2. $root = $_SERVER['DOCUMENT_ROOT'];
  3. $fullpath ="$root/testmenow";
  4. $ch = curl_init ($urlImage);
  5. curl_setopt($ch, CURLOPT_HEADER, 0);
  6. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  7. curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
  8. $rawdata=curl_exec($ch);
  9. curl_close ($ch);
  10.  
  11. $fp = fopen($fullpath,'c+');
  12. $r = fwrite($fp, $rawdata);
  13.  
  14.  
  15. fclose($fp);
  16.  
  17. return $r;
  18. }
  19.  
  20.  
  21.  
  22. ;
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 2)
aras785
post
Post #2





Grupa: Zarejestrowani
Postów: 859
Pomógł: 177
Dołączył: 29.10.2009

Ostrzeżenie: (0%)
-----


http://php.net/manual/pl/function.copy.php
Go to the top of the page
+Quote Post
JakubBab
post
Post #3





Grupa: Zarejestrowani
Postów: 96
Pomógł: 2
Dołączył: 13.07.2015

Ostrzeżenie: (0%)
-----


Cytat(aras785 @ 6.04.2016, 13:29:34 ) *



Czesc, Dzieki.

Funkcja niepotrzebna ale komentarz pod nia niezbedny!

  1. "Having spent hours tacking down a copy() error: Permission denied , (and duly worrying about chmod on winXP) , its worth pointing out that the 'destination' needs to contain the actual file name ! --- NOT just the path to the folder you wish to copy into.......
  2. DOH !
  3. hope this saves somebody hours of fruitless debugging"
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 21.08.2025 - 19:01