我會給我的問題一個非常詳細的基礎。下載文件到服務器用PHP然後分離文件的內容
首先,我試圖使用RuneScape Highscore API創建一個家族查找。
要生成特定家族的用戶列表中,你需要去這個網站:http://services.runescape.com/m=clan-hiscores/members_lite.ws?clanName=X
一旦去這個網站,它會啓動下載的文件本頁面。當打開時,它是由逗號分隔的,因此看起來像這樣:
Clanmate, Clan Rank, Total XP, Kills
Kol,Owner,214278437,10
Biteem,Deputy Owner,709189979,39
KitKatKiller,Deputy Owner,267880637,1
Spooky,Deputy Owner,692887397,773
Ghost Team,Overseer,1333197602,323
Yamilla,Overseer,1873041891,56
要說明什麼,我想做的事,是我想要的用戶鍵入一個名稱的戰隊,然後當他們點擊提交,供它將文件下載到MY文件服務器,然後顯示.ws文件的內容,但忽略Clanmate列中的所有內容。
因此,舉例來說,如果在公會名稱輸入的用戶「刷爆」我想讓它顯示:
Kol
Biteem
KitKat
Spooky
Ghost Team
Yamilla
我有一個起點PHP代碼,但是我不知道如何下載文件,或者分離.ws文件的每個內容,然後在頁面上顯示所有這些名稱。
<?php
session_start();
if ($_POST['submit']) {
//This should be changed to downloading the file to the file server
//But this is the format that the link should be.
header('Location: http://services.runescape.com/m=clan-hiscores
/members_lite.ws?clanName='.$_POST['clanname']);
}
?>