2013-05-01 119 views
3

我收到警告。PHP腳本fopen無法打開流:>無效參數錯誤

警告:的fopen(76561197992146126 .TXT):未能打開流:用C 無效參數:\ WAMP \ WWW \在線下載\ t3.php 6

大家很奇怪,這是main.txt以下(http://pastebin.com/53chSRRz

<?php 
    $APIkey = 'APIKeyHere'; 
    $file = file('C:\wamp\www\Download\main.txt'); 
    foreach ($file as $link) { 
    $link2 = "http://api.steampowered.com/ITFItems_440/GetPlayerItems/v0001/?key=" . $APIkey . "&SteamID=" . $link . "&format=json"; 
    $downloaded = file_get_contents($link2); 
    $fh = fopen($link . ".txt", "a"); //or die("can't open file"); 
    fwrite($fh, $downloaded); 
    } 
    echo "Finished"; 
?> 

的內容,如果我取代 「的fopen($鏈接。」 .TXT 「 」A「),」 用它工作的靜態文件名。但我需要$鏈接作爲文件名。這是我的設置必不可少的。

我正在使用WAMP 2.2的Windows 7 64位系統與PHP 5.4.3

回答

6

你鏈路ID在其中有空白。在創建$link2之前嘗試添加$link = trim($link);

+3

HOLY廢話廢話。你不知道我在這上面花了多少時間才能讓這條小線修復它。非常感謝xD – SuperMar1o 2013-05-01 01:06:31