Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] fopen na curl oraz funkcja fgets
pietras65
post
Post #1





Grupa: Zarejestrowani
Postów: 3
Pomógł: 0
Dołączył: 22.03.2013

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


Hej mam problem ponieważ mój serwer ma ustawione allow_url_fopen = OFF (kontaktowałem się z adminem i tego nie aktywuje, próbowałem oszukać za pomocą htacces oraz ini_set i niestety nie da rady).

Problem polega na tym, że mam funkcję obsługującą dotpay w której zmieniłem fopen na curl jednak jest problem z funkcją fgets po takiej zmienie pojawia się błąd:
ErrorException [ 2 ]: fgets() expects parameter 1 to be resource, string given ~ MODPATH/site_payment/classes/dotpay.php [ 30 ]
  1. public static function check_code($service, $code)
  2. {
  3. self::_init();
  4.  
  5. $url = "http://dotpay.pl/check_code.php?id=".self::$_config['client_id']."&code=".$service."&check=".$code."&type=".self::$_config['account_type']."&del=".self::$_config['delete_codes'];
  6.  
  7. $ch = curl_init();
  8. $timeout = 5;
  9. curl_setopt($ch, CURLOPT_URL, $url);
  10. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  11. curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
  12. $handle = curl_exec($ch);
  13. curl_close($ch);
  14.  
  15. /*$handle = fopen($url, 'r');*/
  16. $status = fgets($handle,8);
  17. if ($status == 0)
  18. {
  19. return TRUE;
  20. }
  21. return FALSE;
  22. }


Byłby ktoś w stanie pomóc mi z tym problemem? będę bardzo wdzięczny.
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 24.08.2025 - 15:22