I am trying to make a HTTP Request from one of my controller to contact another URL, the goal being to contact another URL, and to simply print the HTML answer in my page. I tri
Two problems.
First of all, that's not the proper usage of Symfony\Component\HttpFoundation\Request::create()
, which is a static initializer/factory of sorts. Your code should look like this
$r = Request::create( 'http://www.google.com', 'GET' );
Now you have a proper Request object. However, this is irrelevant which is your second problem: that's not how Symfony's request object is designed to work. Its purpose is not for executing HTTP requests, its for representing them as objects in the framework.
Long story short, you can't do it that way. Perhaps you can use cURL to scrape the page you want?