Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> problemy z fsockopen, Unable to find the socket transport "htt
lucas131
post
Post #1





Grupa: Zarejestrowani
Postów: 30
Pomógł: 0
Dołączył: 21.03.2005

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


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?
Go to the top of the page
+Quote Post
donpablo
post
Post #2





Grupa: Zarejestrowani
Postów: 55
Pomógł: 0
Dołączył: 28.02.2005

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


skrypt wyglada w porządku
a dla innych serwisów próbowałeś(IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif)
Go to the top of the page
+Quote Post
hwao
post
Post #3


Developer


Grupa: Moderatorzy
Postów: 2 844
Pomógł: 20
Dołączył: 25.11.2003
Skąd: Olkusz




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]
Go to the top of the page
+Quote Post

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: 23.08.2025 - 21:31