[PHP] Encoding Question for getting pages
Hello, If im using cURL to grab pages, i like to set a $referer and $userAgent string. Easy enough right? If I do not encode the referer and ua strings my cURL functions do not seem to work, BUT, if I *do* encode them, they come out looking like this in the server logs.. Mozilla%2F4.0%20%28compatible%3B%20MSIE%206.0%3B%20Windows%20NT%205.1%0A that one is using rawurlencode() but it's just as bad with urlencode - How *should* I be doing this? thx! -- Nick W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Encoding Question for getting pages
Mozilla%2F4.0%20%28compatible%3B%20MSIE%206.0%3B%20Windows%20NT%205.1%0A that one is using rawurlencode() but it's just as bad with urlencode - How *should* I be doing this? is this how you tried to do it? $userAgent = Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0); curl_setopt($ch, CURLOPT_USERAGENT, $userAgent); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Encoding Question for getting pages
* and then Matt M. declared Mozilla%2F4.0%20%28compatible%3B%20MSIE%206.0%3B%20Windows%20NT%205.1%0A that one is using rawurlencode() but it's just as bad with urlencode - How *should* I be doing this? is this how you tried to do it? $userAgent = Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0); curl_setopt($ch, CURLOPT_USERAGENT, $userAgent); Yep, but like this: $userAgent = urlencode(Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)); curl_setopt($ch, CURLOPT_USERAGENT, $userAgent); -- Nick W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php