API help how to send one per line per the api documents

Hello I am trying to submit URLs to an API.
Their API states:
Links String[] Yes Uploaded to the POSTs Request Body. Every link must be on a new line. Minimum of 10 links without BatchID.
Here is the API Link: API DOCS

When I submit to the API it seems that only the first url is actually making it through.

Here is my code:
  public function linklicious_upload_links($key)
    {
        if ($key == LINKLICIOUS_CRON_KEY)
        {
            $links = Linklicious::whereStatus(false)->get(['url'])->toArray();

            if (!empty($links))
            {
                $links = implode('\n', array_flatten($links));
               //  dd(@$links);

                $batchId = "9b1288b2-08d0-4753-85bb-TEST";
                $batchName = "test";

                $url = LINKLICIOUS_API_UPLOAD_LINKS . "?AppId=" . LINKLICIOUS_APP_ID . "&ApiKey=" . LINKLICIOUS_API_KEY . "&LinksPerDay=" . LINKLICIOUS_LINKS_PER_DAY . "&BatchName=" . $batchName . "&BatchId=". $batchId;
                $params = array('http' => array('method' => 'POST', 'content' => $links));
                $ctx = @stream_context_create($params);
                $fp = @fopen($url, 'rb', false, $ctx);
                $response = @stream_get_contents($fp);

                Log::info("Linklicious : Upload links triggered...");
                Log::info("Response : " . $response);
            } else
                Log::info("Linklicious : No links available to upload...");
        } else
        {
            Log::info("Linklicious : Invalid key...");
        }
    }

Open in new window


so I seem to be doing something wrong. Any ideas?
austinfxAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

F PCommented:
Did you try making your implode to use "\r\n" instead of just the "\n" ?
0
F PCommented:
OOOOOhhhhh, I see... change the quotes on your implode. You have single quotes, and need double with the \n

$links = implode('\n', array_flatten($links));

*should be*

$links = implode("\n", array_flatten($links));
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
austinfxAuthor Commented:
BLESS YOU BROTHER!!!!!!!!!!! THAT was IT!!
0
austinfxAuthor Commented:
I've requested that this question be closed as follows:

Accepted answer: 0 points for austinfx's comment #a40739387
Assisted answer: 500 points for Frank Pennock's comment #a40739249

for the following reason:

Thank you good sir!
0
F PCommented:
Very welcome! It happens all the time, and I know I've done it before...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.