0

I am new in laravel, my code is

$xmldata = '<?xml version="1.0" encoding="UTF-8"?>
<SmartReportRequest version="1.00">
    <UDIParameter>
        <!-- <Parameter key="HTTPBizID">' . $HTTPBizID . '</Parameter>-->
        <Parameter key="UDIAuthToken">' . $udi_token . '</Parameter>
        <Parameter key="ReportID">1</Parameter>
        <!--<Parameter key="GroupDateType">RowDateRangeLast200Orders</Parameter>-->
        <Parameter key="FromDate">' . $date_from . '</Parameter>
        <Parameter key="ToDate">' . $date_to . '</Parameter>
    </UDIParameter>
</SmartReportRequest>';

//echo $xmldata; exit;


            $result = $this->CurlExec($xmldata, 2);

            $result_xml = simplexml_load_string($result);

when I using this code then given error is :

BadMethodCallException in Controller.php line 107: Method [CurlExec] does not exist. like enter image description here

please give me suggestion how to fix this ? I was trying https://github.com/ixudra/curl but didn't get solution. thanks!

Neeraj Prajapati
  • 541
  • 5
  • 24

1 Answers1

0

I'm not sure what you are trying to achieve, it seems you want to send some XML via CURL but you haven't even specified an endpoint or URL to send this data to.

CurlExec() is not a valid method anywhere I can see, just seems a little similar to php's curl_exec() which is not used the way you are trying to use it.

Here is an example of how to send the xml to an endpoint as post data using Ixudra\Curl but again I have no idea the requirements of your endpoint or how they expect data.

// Top of the file
use Ixudra\Curl\Facades\Curl;

// In your function below $xmldata definition
$response = Curl::to('URL OF ENDPOINT HERE')
    ->withData(['xml' => $xmldata])
    ->post();

See this post on information on how to send xml data using normal PHP and not Ixudra Curl. Sending XML in Curl PHP

HelloSpeakman
  • 810
  • 9
  • 22