Current location: Hot Scripts Forums » Programming Languages » PHP » [SOLVED] Textarea To Array


[SOLVED] Textarea To Array

Reply
  #11 (permalink)  
Old 12-26-08, 07:13 PM
!Unreal's Avatar
!Unreal !Unreal is offline
Wannabe Coder
 
Join Date: Aug 2008
Posts: 147
Thanks: 0
Thanked 0 Times in 0 Posts
The path is definatly correct. It created the file but it's just a filename. Not the webpage.
__________________
Free Online Movies
Reply With Quote
  #12 (permalink)  
Old 12-26-08, 07:21 PM
DAL's Avatar
DAL DAL is offline
Code Master
 
Join Date: Jun 2003
Location: North East England/UK
Posts: 874
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:

PHP Code:

$MyLines explode("\n",$_POST['MyTextArea']);



foreach(
$MyLines as $L){
   
$page file_get_contents($L);
   
$num md5(time());
   
$filename 'cache/'.$num.'.html';
   
file_put_contents($filename,$page);

Then you've identified that the file_put_contents works however retrieving the contents through file_get_contents($L) doesnt read the file.

try this to make sure your getting something;

PHP Code:

$MyLines explode("\n",$_POST['MyTextArea']);



$page file_get_contents($MyLines[0]); //Change 0 to which ever array element you wish to check.
echo $page
The other issue could be that your trying to test 1 line: this isnt an array and you should see a message saying something like foreach supplied invalid array or something like it so make sure you enter on the end of your url if you are testing just 1 path.
__________________
"once upon a midnight dreary, while i pron surfed, weak and weary, over many a strange and spurious site of 'hot xxx galore'. While i clicked my fav'rite bookmark, suddenly there came a warning, and my heart was filled with mourning, mourning for my dear amour," 'Tis not possible!", i muttered, "give me back my free hardcore!" quoth the server, 404."
Reply With Quote
  #13 (permalink)  
Old 12-26-08, 10:21 PM
!Unreal's Avatar
!Unreal !Unreal is offline
Wannabe Coder
 
Join Date: Aug 2008
Posts: 147
Thanks: 0
Thanked 0 Times in 0 Posts
Ok but I need it to fetch all pages within the array :|
__________________
Free Online Movies
Reply With Quote
  #14 (permalink)  
Old 12-27-08, 06:06 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
PHP Code:

error_reporting(E_ALL);

ini_set('display_errors''1');

$MyLines explode("\n"$_POST['MyTextArea']);

foreach(
$MyLines as $L)
{
   
$L trim($L); // Remove possible carriage return.
   
$page file_get_contents($L);

   
// Uncomment this line to see if the opage was fetched correctly.
   // echo $page;
 
   
$num md5(time());
   
$filename 'cache/'.$num.'.html';
   
   
file_put_contents($filename$page);

Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Make A New Array From An Old Array (Excluding 1 Array Element) w2n PHP 14 08-17-07 03:24 PM
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' Dr. Forensics PHP 3 07-15-06 03:54 PM
Sorting a massive multidimensional array dave111 PHP 1 12-12-05 04:09 PM
Serializing a set of arrays dannyallen PHP 2 10-11-04 03:04 AM
linking to iframe not working :( j0d JavaScript 5 01-19-04 08:14 PM


All times are GMT -5. The time now is 08:26 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.