开发者

Curl Problem, I just don't get it

SOLVED: var_dump revealed that that the issue was of & and & .

Also I would still like to know why curl fetched a page with missing divs. Would anyone be kind enough to explain ?

have been at this problem for 1.5hours now. Narrowed down to something that just doesn't make sense to me. Please help . I am fetching a page using curl. The problem is that when the following code is used: a lot of div tags from the navigation to the left are missing from the fetched page,

$pageToParse = "http://www.themarketgrocer.com.au{$arrayLeftBar[$i]} " ;
                ;
//fetch target page
$curlFetched开发者_如何学Python = http_get($pageToParse, "http://www.google.com") ; //fetched using a curl function
echo $curlFetched['FILE'];

the value of $arrayLeftBar[$i] is fetched from an html page using simplehtmldom. as echoed:

"/index.php?option=com_content&view=category&layout=blog&id=37&Itemid=92"

HOWEVER if

$pageToParse = "http://www.themarketgrocer.com.au{$arrayLeftBar[$i]} " ;

is changed to : (basically manually appending the value of $arrayLeftBar[$i] )

$pageToParse = "http://www.themarketgrocer.com.au/index.php?option=com_content&view=category&layout=blog&id=37&Itemid=92" ;

then the complete page is fetched.

WHY ?? I have echoed the values and they are identical. What silly little thing am I missing?

Edit: THis is how the $arrayLeftBar is being populated: I am pretty sure the problem is here . Coz if I manually create a simple array. Things work.

foreach ($sublevelLinks as $link)
{
    $arrayLeftBar[] = $link->href ;
}


On the $arrayLeftBar[$i] value use urldecode

$query       = urldecode($arrayLeftBar[$i]);
$pageToParse = "http://www.themarketgrocer.com.au{$query}" ;


SOLVED: var_dump revealed that that the issue was of & and & . html_entity_decode($arrayLeftBar[$i]) did the necessary conversion

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜