Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8993923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:18:18+00:00 2026-06-15T23:18:18+00:00

Sorry, if I posted a weird question. Now, I am explaining it properly. I

  • 0

Sorry, if I posted a weird question. Now, I am explaining it properly.

I am trying to scrap a data from a web page say for example from: http://www.koolkart.com/nokia-lumia-800-p8251

I am trying to get price of the device listed in the table near “saholic” it is “Rs. 17759/-” and xpath to it is "//*[@id="price-chart"]/tbody/tr[1]/td[3]"

Now, when I execute the xpath in chrome, it gives the price with space

"

                                Rs. 17759/-
                                "

Now, when I execute it in php

<?php
$xpath = '//*[@id="price-chart"]/tbody/tr[1]/td[3]';          
$html = new DOMDocument();
@$html->loadHTMLFile('http://www.koolkart.com/nokia-lumia-800-p8251');
$xml = simplexml_import_dom($html);   
if (!$xml) {
    echo 'Error while parsing the document';
    exit;
}
echo $xml;
$source_image = $xml->xpath($xpath);
print_r($source_image);
?>

it gives error !

So, is there any solution how to remove those trailing spaces or any other way how to get that price?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T23:18:19+00:00Added an answer on June 15, 2026 at 11:18 pm

    I will assume you want the price then.

    You don’t get the same results in the browser and your script because the tbody tag is added by your browser, but isn’t part of the source.

    You can use an expression like this :

    '//*[@id="price-chart"]/tr[1]/td[3]'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First I am sorry if I posted at the wrong place. Now onto the
Sorry if the question has already posted, I want to know if GAE support
Sorry for this simple question, but I can't solve it... There is an example:
I'm sorry to post a question that's already been posted many times. But I
sorry if a similar question has been posted before, i didn't know what terms
I posted a question about this earlier, but I have more information now and
Sorry for cross posting.The following question is also posted on Elastic Search's google group.
I am sorry if this question is already posted somewhere. I am very new
sorry for my English. I previously posted this question as: Multiple ViewModels request same
Sorry to post a question which has already been posted, however I am really

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.