Jump to content

CURL: &not returns a special character


randomguy1234

Recommended Posts

So, basically, I'm trying to send a GET form through CURL.

Let's say my link is this:

$link = "www.example.com?&rand=&notFirstTime=false&transaction_id=$transactionid&house_type=HOUSE_HOUSE";
curl_setopt($ch, CURLOPT_URL, $link);
$html = curl_exec($ch);

Now, this appeared to work fine, but after I ran a little debugging test, I found out that the "&not" in the link turns into a character, which messes up all the next variables following it, thus they are not sent. One way to dodge this would be to put it in the end, but sometimes things may not be that easy. Currently I'm going for that solution, but I'd like to find another solution for this, in case I have to have two "&not-s" in the link.

"echo curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);" outputs:

www.example.com?&rand=?FirstTime=false&transaction_id=$transactionid&house_type=HOUSE_HOUSE

Now I tried replacing "&" with "&", which seemed to work, but later I found out, that then "$transactionid" will be bugged and not sent. I'm not aware how should I use htmlentities in this case, because I tried it and nothing changed.

 

//"?" being shown instead of the real character in the code I provided.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

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

Guest
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.