PHP and CURL problem. I am sending the $curl_url which is used as a URL heading and using $_GET to extract the values in the receiving page. It works fine in my localhost machine. However, on Bluehost, it fails and I have tracked it down to Bluehost not liking % signs when I do the urlencode. When I test it by removing the % signs, it goes through on Bluehost. The $body variable has HTML coded that has a lot of the typical
$body = urlencode($body);//to make html characters work with curl url
$curl_url = 'http://'.$_SERVER['HTTP_HOST'].'/login/email_social_login.php?email='.$social_email.'&name='.$social_name.'&subject='.$subject.'&body='.$body;
$curl_url = str_replace(' ', '+', $curl_url);//spaces not working with curl, so this modifies it to work
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $curl_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_TIMEOUT_MS, 10); //just some very short timeout
curl_exec($ch);
curl_close($ch);
Any insight on how to make this work with Bluehost or a workaround would be appreciated. Perhaps a different type of encoding without % signs?