Answer the question
In order to leave comments, you need to log in
DiDom php, how to parse a site?
Good afternoon!
I use DiDom for parsing, an error occurred with the site https://asos.com, an error occurs when creating a document.
I tried cURL before, it doesn't work either. What could be the problem, maybe in the site itself?
the code:
use DiDom\Document;
use DiDom\Query;
class Model_Parser extends Model{
use Singleton;
public static function action_index(){
$document = new Document('https://asos.com', true);
print_r($document);
}
} #end of class
Warning: file_get_contents(https://asos.com): failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden in C:\Server\data\www\bills\composer\vendor\imangazaliev\didom\src\DiDom\Document.php on line 339
Fatal error: Uncaught RuntimeException: Could not load file https://asos.com in C:\Server\data\www\bills\composer\vendor\imangazaliev\didom\src\DiDom\Document.php:345 Stack trace: #0 C:\Server\data\www\bills\composer\vendor\imangazaliev\didom\src\DiDom\Document.php(236): DiDom\Document->loadFile('https://asos.co...') #1 C:\Server\data\www\bills\composer\vendor\imangazaliev\didom\src\DiDom\Document.php(64): DiDom\Document->load('https://asos.co...', true, 'html') #2 C:\Server\data\www\bills\AAV\usr\Parser\Model_Parser.php(23): DiDom\Document->__construct('https://asos.co...', true) #3 C:\Server\data\www\bills\AAV\usr\Parser\Controller_Parser.php(14): Model_Parser::action_index() #4 C:\Server\data\www\bills\AAV\Core\Route.php(209): Controller_Parser::action_index() #5 C:\Server\data\www\bills\AAV\App.php(21): AAV\Core\Route::run() #6 C:\Server\data\www\bills\htdocs\index.php(32): AAV\App::run() #7 {main} thrown in C:\Server\data\www\bills\composer\vendor\imangazaliev\didom\src\DiDom\Document.php on line 345
Answer the question
In order to leave comments, you need to log in
You need to download the certificate file and register it in php.ini
see my answer here
your code uses file_get_contents, you can do it with it, but you will have to register, for example, disabling ssl checks.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question