Page 1 of 1

How to convert urls to docs

Posted: Wed Mar 19, 2008 12:35 pm
by ngprasad
I am unable to fix this task.Can you please help me.

It is working only for text data.But, not working for webpage content.

For text data, Can you please check it in

http://www.celltonet.com/urltodoc4.php

Enter these urls http://www.php.net , http://www.microsoft.com[I am using comma seperator between urls.] in text box and click on "Create Doc".

For webpage,Can you please check it in

http://www.celltonet.com/urltodoc.php

If i enter these urls http://www.php.net , http://www.microsoft.com in text box and click on "Create Doc".I am receving content for first url only i.e http://www.php.net But, i am not getting second page content.

How to display second page conetent in doc file?

Re: How to convert urls to docs

Posted: Wed Mar 19, 2008 1:01 pm
by Zoxive
This post is essentially useless without showing the code that is creating the docs, and grabbing the data.

Pointing out what does what, and what you are having problems with and what you have tried.

Re: How to convert urls to docs

Posted: Wed Mar 19, 2008 8:23 pm
by ngprasad
My code is

$str1=trim($_REQUEST['urls']);
$str=explode(",",$str1);
for($i=0;$i<count($str);$i++) {
$handle = fopen(trim($str[$i]), "r");
$content= stream_get_contents($handle);
$myarray[]=$content;
fclose($handle);
}
$mystring = implode("\x0C", $myarray);
file_put_contents("urltodoc.doc",$mystring);
header('Content-type: application/msword');
header('Content-Disposition: attachment; filename="urltodoc.doc"');
readfile('urltodoc.doc');