0

How would I go about passing a user agent when requesting an external xml feed from a 3rd party web service. Need to pass the user agent or else the feed produces an error. I am using DOM

<?php
$request1 = 'http://www.abc123.com/webservice/this.xml';

$requestIT1 = $request1;
$response1 = new DOMDocument();
$response1->load($requestIT1);
?>

Thanks in advance!

Edited by nav33n: Added [code] tags.

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by lonestar23
0

Final Solution which seems to work so far:

<?php
//USER AGENT FIX	 
$opts = array(
    'http' => array(
        'user_agent' => 'SearchClash/1.0',
    )
);   

$requestIT = $curl0;
$response = new DOMDocument();
//SEND USER AGENT 
$context = stream_context_create($opts);
libxml_set_streams_context($context);
$response->load($requestIT);
?>

Thanks for all the help!

Edited by nav33n: For easy readability, use [code][/code] tags.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.