0
Example: I give one file_get_contents('http://youtube.com')
and then, should we src
and href
html does not have the whole path, but only src="/pasta/arquivo.ext"
, instead of src="https://youtube.com/pasta/arquivo.ext"
, the requests will give all 404 not found
, because it fetches on my server (localhost).
Is there any parameter of header http
that I can switch to indicate where I want these requests to go? I tried to rewrite and place the entire path in the references, through str_replace()
, but it’s no use, because javascript files request to the local server (localhost) and disrupt the operation in the same way. You can’t keep downloading everything and rewriting; I wanted to change this in the http header (I think it’s possible)
Youtube was just an example. I don’t want to copy the site but make modifications to the embed player’s css. (I don’t want libs, I’m doing this as an exercise)
Thank you all.
You can also use
parse_url
and if you don’t find the host is a relative url.– Papa Charlie
I was talking about changing the browser’s understanding of the real host of the relative address. That way, I’d have to replace all the html, right? If so, it’s no good. But thanks anyway.
– Seu Madruga
So it is not clear what you ask. Describe better if the question will not be closed. @inovapixel
– Daniel Omine
@Danielomine summary: what I want is to make the browser understand that the address is related to another site that I want. I want to know if you can do this in the HTTP header, request header or Response, I don’t know. Got it? I want when the site is omitted from href or src, the browser to associate the "URL" to any site I want, and not the address bar...
– Seu Madruga
Describe it in the question, but you’re still confused. What is this browser talk? Or I’m too slow to catch what I want to do or I’m really confused.. rsr Try drawing, make an illustration and things like that. O
str_replace()
nor is it necessary. Just prefix the domain with the Urls you find. I didn’t understand the section where you embed everything in Javascript and localhost. What the hell does that mean? rsrs Describe it in the question and not here in the comment because here you don’t have adequate space. @inovapixel– Daniel Omine
@Danielomine, from what I understand - maybe - whatever he wants to get close to the tag
<base>
for relative archives.– Papa Charlie