I was just starting to test use Simple HTML DOM Parser to parse google.com, while getting the following error:
Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /Applications/Ampps/www/scraper/simplehtmldom_1_9_1/simple_html_dom.php on line 82
Warning: file_get_contents(): Failed to enable crypto in /Applications/Ampps/www/scraper/simplehtmldom_1_9_1/simple_html_dom.php on line 82
Warning: file_get_contents(https://google.com): failed to open stream: operation failed in /Applications/Ampps/www/scraper/simplehtmldom_1_9_1/simple_html_dom.php on line 82
And my scraper_test.php looks like this:
include('./simplehtmldom_1_9_1/simple_html_dom.php');
$html = file_get_html('https://google.com');
echo $html->find('title', 0)->plaintext;
Related
I want to GET a XML feed using simplexml_load_file() and I want to handle the errors by myself. The problem is, libxml_use_internal_errors(true) does not remove all the warnings. Here is my exact code:
<?php
libxml_use_internal_errors(true);
$url = "http://feeds.feedburner.com/GoogleOnlineSecurityBlog";
$res = simplexml_load_file($url);
When I purposefully write a typo in the URL, I get these warnings:
Warning: simplexml_load_file(): php_network_getaddresses: getaddrinfo failed: Unknown host. in C:\xampp\htdocs\test.php on line 4
Warning: simplexml_load_file(http://feeds.feedburener.com/GoogleOnlineSecurityBlog): failed to open stream: php_network_getaddresses: getaddrinfo failed: Unknown host. in C:\xampp\htdocs\test.php on line 4
Warning: simplexml_load_file(): I/O warning : failed to load external entity "http://feeds.feedburener.com/GoogleOnlineSecurityBlog" in C:\xampp\htdocs\test.php on line 4 error
Adding or removing libxml_use_internal_errors(true) only adds/removes the last warning and not the first 2. What did I do wrong? I have PHP 7.2.2.
Thank you for your help.
I have a created a domain but all the functions and classes of that domain is to be stored on another domain. but i am unable to get the page using include or require method. I am getting the following error:
Warning: include_once() [function.include-once]: Failed to enable crypto in /domain.com/includes/functions.php on line 3 Warning: include_once(https:/other_domain.com/access.php) [function.include-once]: failed to open stream: operation failed in /domain.com/includes/functions.php on line 3 Warning: include_once() [function.include]: Failed opening 'otherdomain.com/access.php' for inclusion (include_path='.:/opt/php52/lib/php') in /domain.com/includes/functions.php on line 3
The crypto error leads me to think this may be an issue with your SSL:
OPENSSL file_get_contents(): Failed to enable crypto
I am trying to access a php script from my other site to my new site and I Am getting this error:
Warning: require_once(): SSL operation failed with code 1. OpenSSL
Error messages: error:14077410:SSL
routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure in
/home/newsite/public_html/abc.php on line 3
Warning: require_once(): Failed to enable crypto in
/home/newsite/public_html/abc.php on line 3
Warning: require_once(https://www.example.com/abc/abc.xyz.php): failed
to open stream: operation failed in /home/newsite/public_html/abc.php
on line 3
Fatal error: require_once(): Failed opening required
'https://www.example.com/abc/abc.xyz.php'
(include_path='.:/usr/local/lib/php') in
/home/newsite/public_html/abc.php on line 3
I just bought rapid SSL as I thought this was SSL issue and SSL is activated now but I still get same error.
i am having a problem with PHP file_get_contents.i am trying to fetch inforamtion following url but is not getting information.it's showing following error.i have try curl code also but same error is displayed
PHP Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages:
error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure in /home/tshah/public_html/pramod/expressdecorViolation/classes/scrap1.php on line 83
PHP Warning: file_get_contents(): Failed to enable crypto in /home/tshah/public_html/pramod/expressdecorViolation/classes/scrap1.php on line 83
PHP Warning: file_get_contents(http://www.overstock.com/Home-Garden/Kraus-30-inch-Undermount-Single-Bowl-Steel-Kitchen-Sink/3381330/customer-reviews.html?rsort=1): failed to open stream: operation failed
mycode is:
$link = 'http://www.overstock.com/Home-Garden/Kraus-30-inch-Undermount-Single-Bowl-Steel-Kitchen-Sink/3381330/customer-reviews.html?rsort=1';
$Page_information = file_get_contents($link);
print_r($Page_information);
I am trying to fetch youtube videos using Youtube Data API URL. Whenever i paste the URL directly in the address bar, it perfectly shows the result. But whenever i try to use that URL in simplexml_load_file() function, i get errors. I cannot figure out what is going on.
This is how i am doing this.
$url = "https://gdata.youtube.com/feeds/api/videos/-/cat";
$output = simplexml_load_file($url);
echo "<pre>";
print_r($output);
echo "</pre>";
I am getting this error message.
Warning: simplexml_load_file(): SSL: The operation completed successfully. in J:\xampp\htdocs\youtube\tube.php on line 23
Notice: simplexml_load_file(): send of 38 bytes failed with errno=10054 An existing connection was forcibly closed by the remote host. in J:\xampp\htdocs\youtube\tube.php on line 23
Notice: simplexml_load_file(): send of 25 bytes failed with errno=10054 An existing connection was forcibly closed by the remote host. in J:\xampp\htdocs\youtube\tube.php on line 23
Notice: simplexml_load_file(): send of 2 bytes failed with errno=10054 An existing connection was forcibly closed by the remote host. in J:\xampp\htdocs\youtube\tube.php on line 23
Warning: simplexml_load_file(https://gdata.youtube.com/feeds/api/videos/-/cat): failed to open stream: HTTP request failed! in J:\xampp\htdocs\youtube\tube.php on line 23
Warning: simplexml_load_file(): I/O warning : failed to load external entity "https://gdata.youtube.com/feeds/api/videos/-/cat" in J:\xampp\htdocs\youtube\tube.php on line 23
I tried to use file_get_contents() function it also gives error.
$url = "https://gdata.youtube.com/feeds/api/videos/-/cat";
$output = file_get_contents($url);
echo $output;
I get these errors using above code.
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: No such host is known. in J:\xampp\htdocs\youtube\tube.php on line 15
Warning: file_get_contents(https://gdata.youtube.com/feeds/api/videos/-/cat): failed to open stream: php_network_getaddresses: getaddrinfo failed: No such host is known. in J:\xampp\htdocs\youtube\tube.php on line 15
I also tried to use simplexml_load_string() function it also gives error.
$url = "https://gdata.youtube.com/feeds/api/videos/-/cat";
$output = simplexml_load_string($url);
echo "<pre>";
print_r($output);
echo "</pre>";
The above code gives me these errors.
Warning: simplexml_load_string(): Entity: line 1: parser error : Start tag expected, '<' not found in J:\xampp\htdocs\youtube\tube.php on line 14
Warning: simplexml_load_string(): https://gdata.youtube.com/feeds/api/videos/-/cat in J:\xampp\htdocs\youtube\tube.php on line 14
Warning: simplexml_load_string(): ^ in J:\xampp\htdocs\youtube\tube.php on line 14
I am using XAMPP v3.2.1 to run my script.
Please help. Thanks.
First you have to check that remote file access is enabled, read the PHP manual page about Using remote files.
After that, and if your firewall is not blocking connections, almost any option that you tried should work. But, in any case, here you have one using simpler commands, or at least simpler concerning what is working internally. Just a good old fopen.
// initialize variables
$url = 'https://gdata.youtube.com/feeds/api/videos/-/cat';
$content = false;
$handle = false;
// open the url/file
$handle = fopen( $url, 'r' );
// get the content from streaming
$content = stream_get_contents($handle);
// close the file reading session
fclose( $handle );
var_dump( $content );