Changing relative URLs of Javascript files

saddiq123

New Member
I'm screen scraping using Curl like this:\[code\]<?php$url = "http://www.bbc.com/news/";$ch = curl_init($url);curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);$curl_scraped_page = curl_exec($ch);curl_close($ch);echo $curl_scraped_page;?> \[/code\]And then I echo the content on an HTML page. The problem is that when I look in my console I see 404 errors because of relative URLs assigned to javascript files. For instance if the URL is: \[code\]somejavascriptfile.js\[/code\] on loading the page my domain name is added like so: \[code\]http://mydomain/somejavascriptfile.js\[/code\] These paths are obviously not correct.So what can I do to get the actual URL of the js file instead? If the URLs where in the body I could use jQuery (split/replace) to alter but this wouldn't work in this case.
 
Back
Top