UserAgent and fopen()

Discussion in 'PHP' started by Thibaut, Mar 11, 2010.

  1. #1
    Hello Friends,

    I would like to know if its possible to change the UserAgent with the fopen() function. When I am using it to fetch URL, no UserAgent is sent to the remote server. Curse is not an alternative for me.

    Regards
    Thibaut
     
    Thibaut, Mar 11, 2010 IP
  2. danx10

    danx10 Peon

    Messages:
    1,179
    Likes Received:
    44
    Best Answers:
    2
    Trophy Points:
    0
    #2
    Use curl, with CURLOPT_USERAGENT:

    Example

    curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 6.0; en-US)');
    PHP:
     
    danx10, Mar 12, 2010 IP
  3. Thibaut

    Thibaut Well-Known Member

    Messages:
    886
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    140
    #3
    TY, but as I wrote Curse is not an alternative for me. Any other idea ?
     
    Thibaut, Mar 13, 2010 IP