[php] Новичкам: задаем вопросы

Discussion in 'PHP' started by _Great_, 26 May 2007.

Thread Status:
Not open for further replies.
  1. bjong

    bjong Elder - Старейшина

    Joined:
    26 Jul 2003
    Messages:
    42
    Likes Received:
    12
    Reputations:
    18
    А как нить подробнее, что должен делать скрипт при запуске? )
    Брать данные из 1.тхт и сохранять их в 1.пхп?
     
  2. krypt3r

    krypt3r Elder - Старейшина

    Joined:
    27 Apr 2007
    Messages:
    1,508
    Likes Received:
    389
    Reputations:
    101
    PHP:
    file_put_contents ('/temp/1.php'file_get_contents ('http://url/1.txt'));
     
  3. Hi4kok

    Hi4kok New Member

    Joined:
    12 Jan 2010
    Messages:
    21
    Likes Received:
    1
    Reputations:
    0
    большое спасибо :)
     
    1 person likes this.
  4. programming

    programming New Member

    Joined:
    26 Aug 2009
    Messages:
    190
    Likes Received:
    3
    Reputations:
    0
    Есть ли альтернативный способ подключения и работы по ftp, кроме использования стандартных функций ftp_connect(), ftp_nlist() и т.д., а также сокетов?
     
  5. miako

    miako Member

    Joined:
    20 Jan 2010
    Messages:
    154
    Likes Received:
    13
    Reputations:
    5
    А чем не устраивают?
     
  6. programming

    programming New Member

    Joined:
    26 Aug 2009
    Messages:
    190
    Likes Received:
    3
    Reputations:
    0
    Отключены на вирт хосте.. Хост не хочет включать.
     
  7. Gifts

    Gifts Green member

    Joined:
    25 Apr 2008
    Messages:
    2,494
    Likes Received:
    807
    Reputations:
    614
    programming file_get_contents, fopen - тоже умеют работать с фтп
     
    _________________________
    1 person likes this.
  8. programming

    programming New Member

    Joined:
    26 Aug 2009
    Messages:
    190
    Likes Received:
    3
    Reputations:
    0
    Увы, file_get_contents() тоже не работает.
    А с помощью fopen() каким образом можно получить все названия файлов, лежащие в директории?
     
  9. Gifts

    Gifts Green member

    Joined:
    25 Apr 2008
    Messages:
    2,494
    Likes Received:
    807
    Reputations:
    614
    programming с помощью opendir, scandir можно получить названия файлов
     
    _________________________
  10. programming

    programming New Member

    Joined:
    26 Aug 2009
    Messages:
    190
    Likes Received:
    3
    Reputations:
    0
    Code:
    5.0.0	path supports the ftp:// URL wrapper. 
    4.3.0	path can also be any URL which supports directory listing, however only the file:// URL wrapper supports this in PHP 4
    Вот про функцию opendir. На хостинге 4 версия php.
     
  11. Compton

    Compton Member

    Joined:
    31 Jan 2010
    Messages:
    290
    Likes Received:
    25
    Reputations:
    0
    как можно вывести список из последних добавленных на фтп десяти файлов
     
  12. Gifts

    Gifts Green member

    Joined:
    25 Apr 2008
    Messages:
    2,494
    Likes Received:
    807
    Reputations:
    614
    programming смените хостинг на вменяемый
     
    _________________________
  13. programming

    programming New Member

    Joined:
    26 Aug 2009
    Messages:
    190
    Likes Received:
    3
    Reputations:
    0
    мастерхост.... и какой вменяемый?)
    P.S. купил VDS(радуюсь))))
     
    #15833 programming, 14 Jul 2010
    Last edited: 14 Jul 2010
  14. fox_malder

    fox_malder Active Member

    Joined:
    28 Nov 2008
    Messages:
    162
    Likes Received:
    131
    Reputations:
    73
    народ подскажите как можно спарсить вот это
    Code:
    <table width="540" border="0" cellspacing="0" cellpadding="0"><tr bgcolor="#000000"><td><table border="0" cellspacing="1" cellpadding="0" align="center" width="540">
                  <tr>
                    <td bgcolor="#000000">&nbsp;</td>
                    <td align="center" bgcolor="#000000" colspan="7"><p class="white">New 
                        York Spot Price</td>
                    <td></td>
                    <td align="right" bgcolor="#000000"><a href="/market/lights.html"><img src="/images/lightgreen.gif" width="39" height="17" border="0" vspace="0" hspace="0" alt="light"></a></td>
                  </tr>
                  <tr bgcolor="#F3F3E4">
                    <td bgcolor="#000000">&nbsp;</td>
                    <td align="center" colspan="7" bgcolor="#F3F3E4"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b><font color=GREEN>MARKET IS OPEN</font><BR>(Will close in 6 hrs. 44 mins.)</b></font></td>
                    <td colspan="2" align="center" bgcolor="#F3F3E4">&nbsp;</td>
                  </tr>
                  <tr bgcolor="#F3F3E4" align="center">
                    <td bgcolor="#000000">&nbsp;</td>
                    <td bgcolor="#CCCC99"><p>Metals</td>
                    <td bgcolor="#CCCC99"><p>Date</td>
                    <td bgcolor="#CCCC99"><p>Time<br>
                        (EST)</td>
                    <td bgcolor="#CCCC99"><p>Bid</td>
                    <td bgcolor="#CCCC99"><p>Ask</td>
                    <td colspan="2" bgcolor="#CCCC99"><p>Change</td>
                    <td bgcolor="#CCCC99"><p>Low</td>
                    <td bgcolor="#CCCC99"><p>High</td>
                  </tr>
                  <tr bgcolor="#F3F3E4" align="center">
                    <td bgcolor="#000000" nowrap><a href="/charts/livegoldnewyork.html" onMouseOver="ChangeImage('NY1','0')" onMouseOut="ChangeImage('NY1','1')"><img src="/images/graph_down.gif" vspace="0" hspace="0" border="0" name="NY1" width="16" height="13" alt="Gold Charts"></a></td>
                    <td align="left"><p>&nbsp;<a href="/charts/livegoldnewyork.html" onMouseOver="ChangeImage('NY1','0')" onMouseOut="ChangeImage('NY1','1')">GOLD</a></td>
                    <td><p>07/15/2010</td>
                    <td><p>10:32</td>
                    <td><p>1206.60</td>
                    <td><p>1207.60</td>
                    <td><p class=spotred>-1.90</p></td>
                    <td><p class=spotred>-0.16%</p></td>
                    <td><p>1203.00</td>
                    <td><p>1218.30</td>
                  </tr>
                  
    			  <tr align="center" bgcolor="#F3F3E4">
                    <td bgcolor="#000000"><a href="/charts/livesilver.html#ny" onMouseOver="ChangeImage('NY2','0')" onMouseOut="ChangeImage('NY2','1')"><img src="/images/graph_down.gif" vspace="0" hspace="0" border="0" name="NY2" width="16" height="13" alt="Silver Charts"></a></td>
                    <td align="left"><p>&nbsp;<a href="/charts/livesilver.html#ny" onMouseOver="ChangeImage('NY2','0')" onMouseOut="ChangeImage('NY2','1')">SILVER</a></td>
                    <td><p>07/15/2010</td>
                    <td><p>10:32</td>
                    <td><p>18.22</td>
                    <td><p>18.24</td>
                    <td><p class=spotred>-0.06</p></td>
                    <td bgcolor="#F3F3E4"><p class=spotred>-0.33%</p></td>
                    <td><p>18.16</td>
                    <td><p>18.53</td>
                  </tr>
                  <tr align="center" bgcolor="#F3F3E4">
                    <td bgcolor="#000000"><a href="/charts/liveplatinum.html" onMouseOver="ChangeImage('NY3','0')" onMouseOut="ChangeImage('NY3','1')"><img src="/images/graph_down.gif" vspace="0" hspace="0" border="0" name="NY3" width="16" height="13" alt="Platinum Charts"></a></td>
                    <td align="left"><p>&nbsp;<a href="/charts/liveplatinum.html" onMouseOver="ChangeImage('NY3','0')" onMouseOut="ChangeImage('NY3','1')">PLATINUM</a></td>
                    <td><p>07/15/2010</td>
                    <td><p>10:32</td>
                    <td><p>1525.00</td>
                    <td><p>1535.00</td>
                    <td><p class=spotgreen>+4.00</p></td>
                    <td><p class=spotgreen>+0.26%</p></td>
                    <td><p>1519.00</td>
                    <td><p>1541.00</td>
                  </tr>
                  <tr align="center" bgcolor="#F3F3E4">
                    <td bgcolor="#000000"><a href="/charts/livepalladium.html" onMouseOver="ChangeImage('NY4','0')" onMouseOut="ChangeImage('NY4','1')"><img src="/images/graph_down.gif" vspace="0" hspace="0" border="0" name="NY4" width="16" height="13" alt="Palladium Charts"></a></td>
                    <td align="left"><p>&nbsp;<a href="/charts/livepalladium.html" onMouseOver="ChangeImage('NY4','0')" onMouseOut="ChangeImage('NY4','1')">PALLADIUM</a></td>
                    <td><p>07/15/2010</td>
                    <td><p>10:32</td>
                    <td><p>466.00</td>
                    <td><p>473.00</td>
                    <td><p class=spotgreen>+2.00</p></td>
                    <td><p class=spotgreen>+0.43%</p></td>
                    <td><p>465.00</td>
                    <td><p>476.00</td>
                  </tr>
                </table></td></tr></table>
     
  15. WNZRS

    WNZRS Member

    Joined:
    3 Sep 2009
    Messages:
    295
    Likes Received:
    53
    Reputations:
    1
    Получаешь то, что между "<table width="540" border="0" cellspacing="0" cellpadding="0"></table>" и пасишь данные между "<td></td>"
     
  16. fox_malder

    fox_malder Active Member

    Joined:
    28 Nov 2008
    Messages:
    162
    Likes Received:
    131
    Reputations:
    73
    подскажите плз регулярку я в них не очень силен
     
  17. ZodiaC

    ZodiaC Banned

    Joined:
    15 Jul 2010
    Messages:
    3
    Likes Received:
    1
    Reputations:
    0
    $mass = strip_tags($cont);
    получаешь текст без тегов

    или регуляркой
    $text = preg_match('|<td>(.*)</td>|', $cont);
    там где теги ставь что над
     
    1 person likes this.
  18. Compton

    Compton Member

    Joined:
    31 Jan 2010
    Messages:
    290
    Likes Received:
    25
    Reputations:
    0
    как убрать из слова 10 символов с конца?
     
  19. Gifts

    Gifts Green member

    Joined:
    25 Apr 2008
    Messages:
    2,494
    Likes Received:
    807
    Reputations:
    614
    Compton php.net/substr и внимательно читать примеры
     
    _________________________
  20. Gvidion

    Gvidion Elder - Старейшина

    Joined:
    11 Sep 2009
    Messages:
    82
    Likes Received:
    43
    Reputations:
    28
    как пройти авторизацию мейл.ру? никак немогу сделать, вот ВК просто строка типа

    http://vkontakte.ru/login.php?m=1&email=мыло@bk.ru&pass=123

    а в мейл ру как всё это дело одной строкой авторизироваться?
     
Loading...
Thread Status:
Not open for further replies.