I have this link which works fine.
http://a810-bisweb.nyc.gov/bisweb/PropertyProfileOverviewServlet?boro=3&houseno=512&street=bedford%20ave&requestid=0&s=A03C41B885B461E4F46BD08866A7430E
I want to do the get the content of this URL but the issue is the file_get_contents
content convert &
to &
http://a810-bisweb.nyc.gov/bisweb/PropertyProfileOverviewServlet?boro=3&houseno=512&street=bedford%20ave&requestid=0&s=A03C41B885B461E4F46BD08866A7430E
Which doesn't work.
$url = "http://a810-bisweb.nyc.gov/bisweb/PropertyProfileOverviewServlet?boro=3&houseno=512&street=bedford%20ave&requestid=0&s=A03C41B885B461E4F46BD08866A7430E";
$content = file_get_contents($url);
echo $content;
It generates error.
$url = "http://www.google.com";
$content = file_get_contents($url);
echo $content;
It works fine.
Without setting a
User-Agent
for the request, I get a 403 forbidden error.This code works:
Looks like the site by default disallows the PHP user agent so you will need to specify one using the stream context or use another library like cURL to fetch the content.
This is a common problem when trying to use file_get_contents to fetch remote URLs.