-1

this is my curl array

  CURLOPT_URL => 'https://xxxxxx.com/v2/transaction?ref_id=[ref_id]',

and i need to change [ref_id] to $result['useridInvoice'] what is the best url to solve this problem

help me please to solve my problem

1
  • 1
    Something like str_replace? Commented Jan 21, 2023 at 19:41

1 Answer 1

0

$result['useridInvoice'] to create the final URL.

For example, you can use the following line of code to create the final URL:

$url = 'https://xxxxxx.com/v2/transaction?ref_id=' . $result['useridInvoice'];

Then you can set the value of CURLOPT_URL to this variable:

curl_setopt($curl, CURLOPT_URL, $url);

You can also use the sprintf function to format the URL string and enter the value of$result['useridInvoice']:

$url = sprintf('https://xxxxxx.com/v2/transaction?ref_id=%s', $result['useridInvoice']);
curl_setopt($curl, CURLOPT_URL, $url);

Both of these methods will replace the [ref_id] placeholder in the URL with the value of $result['useridInvoice'], resulting in the desired final URL.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.