Jump to content

Array from CSV and POST URL. Help?


Recommended Posts

I seem to be having a problem with this code. It's supposed to parse the file info.txt and explode comma separated values into an array and then add each value from that file to the end of a URL and POST that url. What I'm getting now is just the first number in the array.

Anyway, here's the code:


$FileName = "info.txt";
$FileHandle = fopen($FileName,"r");
$FileContent = fread ($FileHandle,filesize ($FileName));

// You can replace the \t with whichever delimiting character you are using
$SplitContent = explode("\t", $FileContent);

foreach($SplitContent as $CurrValue)

header('Location: http://website.com/file.php?value=' . $CurrValue);


Link to comment
Share on other sites



This link is used to submit the value as a phone number and a SMS is sent to that number. What I'm trying to do here is automate the bulk sending of one SMS to multiple numbers. So I load the phone number from the text file and append each phone number to the end of the URL so that the URL is submitted, the SMS is send, and then moves on to the next URL.

Link to comment
Share on other sites

this may be of assistance...


You cannot pass an array through a url in it's raw form. You have to

serialize it, encode it, then on the receiving page you unencode it, and

finally unserialize it.




$test = array(1,2,3,4);

$serialized = rawurlencode(serialize($test));

echo "<a href=receive_array.php?testvar=".$test.">Test</a>";



then in recieve_array.php:


$testvar = unserialize(rawurldecode($_GET['testvar']));

echo "<pre>";


echo "</pre>";




source: http://www.justskins.com/forums/passing-array-in-the-120375.html

Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.