F
F
Fozzy7772018-02-21 23:28:26
PHP
Fozzy777, 2018-02-21 23:28:26

How to substitute a variable in an address with Curl?

Good night, tell me how to substitute your variable in the line with the curl address
, there is a code:

$add='user123'
$curl->page('https://www.site.com/');

how to substitute the $add variable in the request so that curl goes to https://www.site.com/user123/
Thanks for the reply

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Decadal, 2018-02-21
@Fozzy777

in its original form:
there are a bunch of variations on the theme, ranging from sprintf to smarter handling of urlencode - because the moment $add starts to contain spaces or special characters, your code will crash.
And there is generally space like http_build_query

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question