0

Ok, so right now I've got this URL, which works perfectly:

$html_string = file_get_contents('https://www.123.com/' . $_GET["ticket"]);

What I want to do is to insert $_GET between the URL.

Here's what I mean:

('https://www.123.com/' . $_GET["ticket"] /url-continues-here);

I have tried everything, but can't find any solution how to do it without an error.

RaymondM
  • 47
  • 1
  • 7

1 Answers1

-1

Concatenate the 2 strings first and after that use file_get_contents()

$html_string = 'https://www.123.com/' . $_GET["ticket"] . '/url-continues-here';
file_get_content($html_string);
manqlele
  • 77
  • 11
  • You have merely re-used the code that the question author explicitly says *works*. – El_Vanja Jan 25 '21 at 09:30
  • The OP just has to concatenate the different parts of the url in string and then use `file_get_content()` instead of trying to do it as the function argument – manqlele Jan 25 '21 at 09:36
  • That is outright wrong. Expressions can be passed as function parameters (unless passed by reference, which isn't the case with `file_get_contents`). – El_Vanja Jan 25 '21 at 09:38
  • I am not saying the can't be passed, I am saying that it will be clearer if he does it this way, and there is a less chance for mistake – manqlele Jan 25 '21 at 09:45
  • "Clearer" is subjective and suggestions don't make suitable answers - they're better off as comments. Besides, your answer does not read as suggestion to make things clearer, it reads as though the issue was in directly passing the concatenated url. – El_Vanja Jan 25 '21 at 13:18