0
votes

I am running PHP Laravel 5.5.* with spatie/browsershot 3.24 and I am having an issue with pulling the HTML from a url that I generate from a route.
Code:

$url = route('pdfs.plans.results', [
                'lang' => $culture->code,
                'id' => $id,
                'user_id' => \Auth::user()->id,
                'pdf-token' => $token->token,
            ]);

And for now I'm just wanting to dd the raw html generated by this route:

dd(Browsershot::url($url)->bodyHtml());

However, this is failing and it appears to be due to the query parameters in the url string
Example url: http://localhost/pdf/plans/results/share?lang=en_US&id=17&user_id=8&pdf-token=PEvWJ7MB7sgQWM9AUfciceL4zNvZrLaSeemGf5J4kGzfOKvaMe8L0FTf32Da
As soon as it hits the second parameter '&id=17' it breaks stating:

'id' is not recognized as an internal or external command

which tells me that NodeJS is what's breaking, I'm guessing the ampersand is throwing it off and it's thinking that I'm passing another command to the console, but I don't know how else to get around this.
Is there a better way to pass the URL, or perhaps an alternative/better way to extract the rendered HTML from a Laravel blade (running VueJS) that I can then use for PDF generation or other business needs?

Thank you!

1

1 Answers

1
votes

Maybe windows only related issue as I havent tried it on Linux yet, but I escaped the & and all now works fine.

$url = str_replace('&', '^&', $url)