PHP Crawl page code, picture path problem
I'm now going to start by crawling the code for the connection URL with PHP code. 、
Ob_start ();
$ch = Curl_init ();
curl_setopt ($ch, Curlopt_url, $url);
curl_setopt ($ch, Curlopt_returntransfer, 1);
curl_setopt ($ch, Curlopt_header, 0);
$retrievedhtml =curl_exec ($ch);
Ob_end_clean ();
Curl_close ($ch);
Now there is a situation, such as the URL of the webpage is http://www.aaa.com/bq/
Then the link address of the picture inside the page is
At this point, the full URL of the picture should be http://www.aaa.com/bq/cq/a.jpg
But after I converted and found that the picture does not appear, later found that the path of the picture is actually
Http://www.aaa.com/cq/a.jpg
How to explain this, how should I judge such a path?
------Solution--------------------
According to common sense, it's not/bq/cq/a.jpg.
You take a good look at this path:
/to the root.
The picture path is http://www.aaa.com/cq/a.jpg
You take a few more pictures immediately understand,/Front no point, jump to the root, there is a point relative to the current path don't confuse it.
------Solution--------------------
The shape is relative to the domain name
The shape or the relative URL.
Don't you write the website yourself?
The light of the others?
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service