0
$Link = 'http://somewebsite.com/api.php?message=someMessage&user_id=' . $UserID . '&password=' . $UserPW;
echo $Link;
echo "<br><br>";
$PageResponse = file_get_contents($Link);
私は実際のサンプルを投稿できませんが、これは私が経験している問題です。PHPのfile_get_contentsがURLの末尾に変更する
私は$のリンクをエコーするとき、それは、これを返します。
http://somewebsite.com/api.php?message=someMessage&user_id=redacted&password=redacted
しかし、このようになりますのfile_get_contentsが返すとエラー:あなたが気づく場合
Warning: file_get_contents(http://somewebsite.com/api.php?message=someMessage&user_id=redacted&password=redacted): failed to open stream: No connection could be made because the target machine actively refused it. in C:\wamp64\www\hello.php on line 14
が、それは "&を変えています"文字を&
に書き換えてURLを破棄します。これに対処する簡単な方法はありますか?
これはバグではありません、それは機能です – Calimero
'file_get_contents'を使う前にURL文字列を' html_entity_decode'しようとしましたか?それ以外の場合は 'str_replace'が役に立ちます。 – Kapparina
がデコードして置き換えようとしました。まだ変換が続く – kamelkid2