Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 222 Vote(s) - 3.47 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Create Carriage Return in PHP String?

#1
We have written a small PHP Hook for our billing system that opens a new support ticket with us when an order is placed. It works except that for the "Open Ticket" API function, it takes a string for the message, but we cannot figure out how to put carriage returns in it.

I have tried

<p>, <br>, \n, \r\n, etc.

As it appears to just be completely plain text though, all of these are just being read verbatim rather than made into carriage returns.

Does anyone have any thoughts on how this could be done?

[To see links please register here]


Reply

#2
$postfields["message"] = "This is a sample ticket opened by the API\rwith a carriage return";
Reply

#3
Carriage return is `"\r"`. Mind the double quotes!

I think you want `"\r\n"` btw to put a line break in your text so it will be rendered correctly in different operating systems.

- Mac: \r
- Linux/Unix: \n
- Windows: \r\n
Reply

#4
There is also the PHP 5.0.2 PHP_EOL constant that is cross-platform !

[Stackoverflow reference][1]


[1]:

[To see links please register here]

Reply

#5
Fragment PHP (in console *Cloud9*):

echo "\n";
echo "1: first_srt=1\nsecnd_srt=2\n";
echo "\n";
echo '2: first_srt=1\nsecnd_srt=2\n';
echo "\n";
echo "==============\n";
echo "\n";

resulting output:

1: first_srt=1
secnd_srt=2

2: first_srt=1\nsecnd_srt=2\n
==============

Difference between 1 and 2: **"** versus **'**
Reply

#6
I find the adding `<br>` does what is wanted.
Reply

#7
PHP_EOL returns a string corresponding to the line break on the platform(LF, \n ou #10 sur Unix, CRLF, \n\r ou #13#10 sur Windows).

echo "Hello World".PHP_EOL;
Reply

#8
i tried with "\\\n" (double backslash + n), and it's worked !

i get this from send test message at insomnia (postman like) with php-curl API to whatsapp number.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through