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!

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!

Google is your friend, 2nd result.
http://www.php.net/manual/en/domdocument.load.php#91384

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!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.