2016-04-24 16 views
0

我想提出一個新的腳本使用的file_get_contents(),但是當我使用這個不能在PHP

$bal= file_get_contents('http://mcent1.nptemp.net/t.php?mobileno='.$no.'&pass='.$pwd'); 
echo "<br>Balance After:".$fbal; 

我無法得到bal這段代碼是用來獲取餘額由用戶估算的細節,但我甚至沒有看到輸入手機號碼和密碼的選項。

+0

的file_get_contents( 'http://mcent1.nptemp.net/t.php?mobileno='.$no.'&pass='.$pwd')<< <最後的報價不應該在那裏。 –

+0

我查過沒有工作 –

+1

問題解決了還是仍然打開?如果解決了問題,那麼考慮接受解決問題的最佳答案,否則人們可能想要發佈更多答案。 –

回答

2

它看起來像你有一個不需要的撇號,並會拋出一個錯誤。

另外,$fbal未定義。

$bal = file_get_contents('http://mcent1.nptemp.net/t.php?mobileno='.$no.'&pass='.$pwd); 
echo "<br>Balance After:".$bal; 
+2

我的更新($ fbal)之後很好的捕獲。 –

+0

我已經upvoted你的答案。 –

+0

@Anant +1也爲你的答案;-) – Panda

7

兩件事情: -

1.Quotes需要被照顧和

2. $fbal是沒有在那裏定義。所以代碼應該是: -

$bal= file_get_contents("http://mcent1.nptemp.net/t.php?mobileno=$no&pass=$pwd"); // use only double quotes 
echo "<br>Balance After:".$bal; // $fbal is no where in the context so use $bal 

或者,這也應爲你工作: -

$bal= file_get_contents('http://mcent1.nptemp.net/t.php?mobileno='.$no.'&pass='.$pwd); // remove the last single quote 
echo "<br>Balance After:".$bal;// $fbal is no where in the context so use $bal 
3

你必須在最後一個額外的單引號。另外,$fbal未定義,它最可能是$bal的錯字。

$bal= file_get_contents('http://mcent1.nptemp.net/t.php?mobileno='.$no.'&pass='.$pwd); 

echo "<br>Balance After:".$bal; 
+0

@Drew謝謝:) – Panda

+0

只是在開玩笑。保持良好的工作 – Drew