Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: problemy z fsockopen
Forum PHP.pl > Forum > PHP
lucas131
Moj skrypt wyglada nastepujaco:
Kod
$fp = fsockopen("http://www.dollars4babes.com", 80, $errno, $errstr, 30);
if (!$fp) {
   echo "$errstr ($errno)<br />\n";
} else {
   $out = "GET / HTTP/1.1\r\n";
   $out .= "Host: www.dollars4babes.com/mpa2/gal/103047/2/1091108724\r\n";
   $out .= "Connection: Close\r\n\r\n";
   fwrite($fp, $out);
   while (!feof($fp)) {
       $szPlik .= fgets($fp, 128);
   }
  
   fclose($fp);
  
   echo $szPlik;
  
   exit();
}


Wynik:
Warning: fsockopen() [function.fsockopen]: unable to connect to http://www.dollars4babes.com:80 (Unable to find the socket transport "http" - did you forget to enable it when you configured php?) in d:\wamp\www\pob_thumb\pob_thumb.php on line 59
Unable to find the socket transport "http" - did you forget to enable it when you configured php? (99221504)

Co musze wlaczyc w php.ini by skrypt zadzialal, moze w skrypcie mam jakies bledy?
donpablo
skrypt wyglada w porządku
a dla innych serwisów próbowałeśquestionmark.gif
hwao
http://forum.php.pl/index.php?showtopic=28...ndpost&p=163095

  1. <?php
  2. function open()
  3. {
  4.  $strKey = key( $this->arrRss2Open );
  5.  if( !isSet( $this->arrRss2Open[$strKey] ) )
  6.  {
  7. $this->arrErrorInfo[] = 'Prosze zdefiniować kolejne linki do odczytu rss';
  8. return FALSE;
  9.  }
  10.  
  11.  $arrUrl = parse_url( $this->arrRss2Open[$strKey] );
  12.  
  13.  $arrUrl['host'] = ( !empty( $arrUrl['host'] ) ? $arrUrl['host'] : '' );
  14.  $arrUrl['path'] = ( !empty( $arrUrl['path'] ) ? $arrUrl['path'] : '/' );
  15.  
  16.  
  17.  if( !$resFp = fsockopen( $arrUrl['host'], 80, $intError, $strError, 3 ) )
  18.  {
  19. $this->arrErrorInfo[] = 'Scierzka \"'.$this->arrRss2Open[$strKey].'\" jest błędna';
  20. return FALSE;
  21.  }
  22.  
  23.  fwrite( $resFp, 'GET '.$arrUrl['path'].' HTTP/1.1'.&#092;"rn\".
  24.  'Host: '.$arrUrl['host'].&#092;"rn\".
  25.  'Connection: Close'.&#092;"rnrn\"
  26.  );
  27.  
  28.  $blnHeader = FALSE;
  29.  $strRss = null;
  30.  
  31.  while( !feof( $resFp ) )
  32.  {
  33. $str = fgets($resFp, 128);
  34.  
  35. if( $str == &#092;"rn\" )
  36. {
  37.  $blnHeader = TRUE;
  38. }
  39.  
  40. if( $blnHeader === TRUE )
  41. {
  42.  $strRss .= $str;
  43. }
  44.  }
  45.  fclose( $resFp ); 
  46.  }
  47.  
  48. ?>

Przeanalizuj i zobacz... (to dziala na 100%)

Pozatym prosze w kolo nie pytac o to samo i uzywac BBCODE [php]
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.