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
https://forums.phpfreaks.com/topic/265674-curl-not-returns-a-special-character/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.