use get parameters in DOMDocument::loadHTMLFile() - php

I want to load an url like this using DOMDocument::loadHTMLFile(): http://www.domain.com/dir/page?param1=235235&param2=2345, but it gives this error, even though the page exists:
Warning: DOMDocument::loadHTMLFile(http://www.domain.com/dir/page?param1=235235&param2=2345): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
How can I solve this?

Related

How do you use file_get_contents() on PhpStorm?

Usually, you could just enter the URL from a website to get the HTML code. However, on PhpStorm, when I try to do:
file_get_contents("http://localhost:63342/Prj1_Submission1/index.php?_ijt=i77g98br35guk27egnuaaj3va6")
where the URL is generated by PhpStorm for my index.php it gives me this error:
Warning: file_get_contents(http://localhost:63342/Prj1_Submission1/index.php?_ijt=i77g98br35guk27egnuaaj3va6): failed to open stream: HTTP request failed! in C:\Users\prajw\PhpstormProjects\Prj1_Submission1\search.php on line 18

Image not loading, Failed to open stream: HTTP request failed

I have the following problem on a Magento2 Fresh installation with dummy data, using the theme [Revo]: https://themeforest.net/item/revo-responsive-magento-2-shopping-theme/18339484
Error filtering template: Warning:
getimagesize(https://website.com/media/wysiwyg/imageslider/slider-1.jpg):
failed to open stream: HTTP request failed! HTTP/1.1 401 Unauthorized
in
/var/www/html/nobacco/vendor/magento/framework/Image/Adapter/AbstractAdapter.php
on line 304
Permissions are correct, nginx settings seem good the image exists on the server and is accessible through the same url and the user rights seems alright too.. Any ideas?
Before this error I was getting an error on vendor/(cant remember the full path)/Image.php

HTTP request failed! HTTP/1.1 403 Forbidden with "Call to a member function find() on boolean in C:\xampp\htdocs\index.php"

I want to extract data from a website but I'm getting a warning.
<?php
include("simple_html_dom.php");
$html = file_get_html("https://ffs-gaming.com/clans.php?clanid=1264");
$title = $html->find("div.number", 0)->innertext;
echo $title;
?>
With other websites it works very well but it doesn't with this one.
I'm getting that warning.
Warning: file_get_contents(https://ffs-gaming.com/clans.php?clanid=1264): failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden in C:\xampp\htdocs\simple_html_dom.php on line 75
Fatal error: Call to a member function find() on boolean in C:\xampp\htdocs\index.php on line 12
Thanks in advance!
They probably only allow real browser requests.
Try to emulate a browser using cUrl:
php curl: how can i emulate a get request exactly like a web browser?

need explanation for wordpress plugin error message

I'm trying to make a plugin work on my site. can someone explain clearly what this error message means?:
Warning: fopen(http://example.com/wp-content/plugins/zoomsearch/zoomsearch.css): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/me/example.com/wp-content/plugins/zoomsearch_wpplugin/zoomsearch.php on line 197

PHP fopen() fails to open url resource

I'd like to fopen this url: http://ec.europa.eu/eurostat/SDMX/diss-web/rest/data/hlth_cd_asdr/A..T.TOTAL.A-R_V-Y./startperiod=2010&endPeriod=2010
like this:
$stream=fopen('http://ec.europa.eu/eurostat/SDMX/diss-web/rest/data/hlth_cd_asdr/A..T.TOTAL.A-R_V-Y./startperiod=2010&endPeriod=2010','r');
but it fails with the following warning:
failed to open stream: HTTP request failed! HTTP/1.1 502 Bad Gateway
What should I do to open this link in PHP?
fopen() wouldn't support http requests so you can use file_get_content() in your scanario. For more detail please read fopen() and file_get_contents() from php.net.

Categories