Help with file_get_html
Posted on
16th Feb 2014 07:03 pm by
admin
The following code gives the expected results:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Generate Description and Tags</title>
</head>
<body>
<?php
include 'simple_html_dom.php';
$entityURL = "http://google.com";
echo "Entity URL: ", $entityURL,"
";
$html = file_get_html($entityURL);
$tot_html_str = $html->save();
$tot_html_strlen = strlen($tot_html_str);
echo "Strlen of total HTML: ",$tot_html_strlen,"
";
?>
</body>
</html>
results in:
Entity URL: http://google.com
Strlen of total HTML: 7403
However, if I read the URL from a file, I am not able to scrape the HTML:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Generate Description and Tags</title>
</head>
<body>
<?php
include 'simple_html_dom.php';
$myFile = "/home/prakash/foo.txt";
$src_handle = fopen($myFile, "r");
$entityURL = fgets($src_handle, 4096);
echo "Entity URL: ", $entityURL,"
";
$html = file_get_html($entityURL);
$tot_html_str = $html->save();
$tot_html_strlen = strlen($tot_html_str);
echo "Strlen of total HTML: ",$tot_html_strlen,"
";
?>
</body>
</html>
results in:
Entity URL: http://google.com
Strlen of total HTML: 0
What do I need to do differently to read the URL from a file.
No comments posted yet
Your Answer:
Login to answer
206 34
Other forums
ereg_replace issue
hi there people
i have this code happening with regards to my wamp server. is this something
Checkbox info wont include in Mailto
Hey, im new to php.
Basically I have made a form to request which type of job(s) are needed, whic
php code to accept and delete incoming data
Using following HTML Code please show me how to write PHP code to accept and delete the incoming dat
bind error during socket programming
i am kinda new to socket programming. wrote the below code for a server. but getting the bind error
PHP MySQL and DATE
Hi everyone
I have a databse and in one of the columns I have date values such as 2009-March-
Require select-option functionality in Module Pool Programming
Hi Gurus,
I am doing a development by Module Pool on Warehouse Management. For that devel
Update Database
Hi All,
I have a problem with this:
Code: [Select]<?php
session_start();
Trying to add functions to table
I have this list of characters and I'm trying to figure out what I have to do to put the results of
List/Menu Box
On an edit page when you want something to select what a user has previously selected from the datab
Update Myspace status with CURL
Logging in:
Code: <?php
class Myspace
{
function login($username, $pa