NachoRuba NachoRuba - 1 year ago 95
PHP Question

Insert a Variable inside simple quotation marks PHP

How i can use a variable ($_REQUEST('subject')) inside simple quotation marks.
This is my code:

$uri = '';

$postString = '{//i can't quit this quotation mark
"key": "myapi",
"message": {
"html": "this is the emails html content",
"subject": "$_REQUEST['subject'];",//this dont work
"from_email": "",
"from_name": "John",
"to": [
"email": "",
"name": "Bob"
"headers": {
"auto_text": true
"async": false

ldg ldg
Answer Source

change "subject": "$_REQUEST['subject'];" to "subject": "' . $_REQUEST['subject'] . '"

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download