Hi I’m trying to use this script to return a value from another php script on my site without leaving the page, but I am getting the number 1 after the string (I’m assuming that the 1 is the resource number) This is the script:
<?php
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://www.example.com/");
curl_setopt($ch, CURLOPT_HEADER, false);
// grab URL and pass it to the browser
$result = curl_exec($ch);
// close cURL resource, and free up system resources
curl_close($ch);
echo $result;
?>
Output is somthing like this:
"<?php include \\\\localfolder\\blabla\script.php ?>1"
and the 1 at the end is what I don’t want showing up.
Thanks,
Robert
You need to set the
CURLOPT_RETURNTRANSFERoption to true:From the documentation: