As for snap two, try echoing the filename you're trying to fopen: do: $fn = "http://babynames.pregnancy.yahoo.com/bnfname?n=$name" echo "$fn\n"; $fp = fopen($fn, "r"); Weird...maybe this yahoo service was doing at that moment? "Tribun" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > the following problem: > > I want to read out, if the firstname is a boy's name or a girl's name... > > therefore I've written this code: (which allready works) > > ------------------ <snap> ------------------- > > $fp=fopen('http://www.vornamenlexikon.de/main/suchen.asp?kriterium=search&B1 > =Suchen&action=searchnow&searchby='.$name,"r"); > if($fp){ > $daten=fread($fp,100000); > fclose($fp); > $male='/m.gif'; > $female='/w.gif'; > if((strpos($daten,$female)>0)&&(strpos($daten,$male)>0)){ > if(strpos($daten,$male)>strpos($daten,$female))$result='w'; > else $result='m'; > }else if(strpos($daten,$female)>0)$result='w'; > else if(strpos($daten,$male)>0)$result='m'; > } > if(empty($result)){ > > $fp=fopen('http://www.kindername.de/'.strtolower(substr($name,0,1)).'-namen. > htm',"r"); > if($fp){ > $namen=array(); > $daten=fread($fp,100000); > fclose($fp); > > $daten=strstr($daten,'<font size="4" face="Verdana, Arial, Helvetica, > sans-serif"><B>VORNAMEN MIT'); > for($cnt=0;strpos($daten,'<tr>')>0;$cnt++){ > $daten=substr(strstr($daten,'<tr>'),4); > $tag=substr($daten,0,strpos($daten,'</tr>')); > if(strpos($tag,'</td>')>0){ > $x1=substr(strstr($tag,'<td>'),4); > while(strpos($x1,' ')>0)$x1=str_replace(' ',' ',$x1);//TAB > while(strpos($x1,' ')>0)$x1=str_replace(' ',' ',$x1);//DBLSPACE > $x1=trim($x1); > for($i=1;strpos($x1,'<td>')>0;$i++){ > > $field=strtolower(trim(strip_tags(substr($x1,0,strpos($x1,'</td>'))))); > if($i==1)$namen[$cnt]=array($field); > else if($i==2)$namen[$cnt]['gender']=trim($field); > else if($i==3){ > while(strpos($field,',')>0){ > array_push($namen[$cnt],substr($field,0,strpos($field,','))); > $field=substr(strstr($field,','),1); > } > array_push($namen[$cnt],$field); > }else if($i==4){ > if(in_array($name,$namen[$cnt]))$result=$namen[$cnt]['gender']; > } > $x1=substr(strstr($x1,'<td>'),4); > } } } } } > ------------------ </snap> ------------------- > > This code works, but I wanted to include another Datebase (Yahoo) > > So I included this function: > > ------------------ <snap> ------------------- > $fp=@fopen('http://babynames.pregnancy.yahoo.com/bnfname?n='.$name,"r"); > if($fp){ > $daten=fread($fp,10000); > fclose($fp); > $male='boy'; > $female='girl'; > if((strpos($daten,$female)>0)&&(strpos($daten,$male)>0)){ > if(strpos($daten,$male)>strpos($daten,$female))$result='w'; > else $result='m'; > }else if(strpos($daten,$female)>0)$result='w'; > else if(strpos($daten,$male)>0)$result='m'; > } > ------------------ </snap> ------------------- > > But this code has no effect. It returns only an Error (404) > > The reason therefore is, that the targetting URL does'nt > exist: > > Try this URL's > > http://babynames.pregnancy.yahoo.com/bnfname?n=Patrick > or > http://babynames.pregnancy.yahoo.com/bnfname.htm?n=Patrick > http://babynames.pregnancy.yahoo.com/bnfname.?n=Patrick > http://babynames.pregnancy.yahoo.com/bnfnameBLABLA?n=Patrick > > In a Browser its not nessesary to type in the correct Name > "bnfname". So you can add what ever you want, but the result > is the same (it works) > > But the problem is, to downloading this file, because then the reason > is an 404-Error (not existing) > > Does anybody know an answer to this problem??? > > How can I download this file anyway... and read out the information > I want? > > > > Thanks, > Tribun (Patrick) > --- > www.mp3o.net > > > PS: I know. its not the best english ;) > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]