user882347
user882347

Reputation:

Extending cURL max URL length or other options?

I'm sending a rather long URL with cURL and I'm almost positive that it's too long for cURL to handle. The URL is http://hiscore.runescape.com/index_lite.ws?player= and after the ?player= paramter, there can be up to 12 numbers/letters/symbols.

Is there an alternative to cURL which would support long URLs like that, or could I use cURL with that long of a URL somehow?

Upvotes: 5

Views: 13266

Answers (2)

amigura
amigura

Reputation: 139

symbols could be the possible cause use some thing like

urlencode

base64-encode

function getStats($username) { echo $username // to see if username is being sent to this function

just run this code as a standalone to see if it works

function getStats($username) {
    $ch = curl_init();
    $data = array('player' => '$username');
    curl_setopt($ch, CURLOPT_URL, 'http://hiscore.runescape.com/index_lite.ws');
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
    curl_exec($ch);
}

getStats('what_ever_username');

Upvotes: 1

Rafe Kettler
Rafe Kettler

Reputation: 76955

There is no limit on the length of URLs with libcurl or PHP cURL. So this is a non-issue.

What leads you to believe that there are size limits?

Upvotes: 5

Related Questions