0

I am able to successfully use the something like this $_REQUEST on my page when its loaded in PHP:

<?php echo $_REQUEST['topicname']; ?>

However, when I then try to use that "topicname" on the same page to grab a webpage via cURL it fails and gets me this error:

PHP Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING)

This is the way I am trying to implement the code when it throws that error:

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.domain.net/reports/?search=. $_REQUEST['topicname'] .");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
?>

Ideas on what should be altered? Thank you

THX1138
  • 13
  • 1
  • 4

1 Answers1

0
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.domain.net/reports/?search=". $_REQUEST['topicname'] );
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
?>
Sumesh S
  • 758
  • 5
  • 11