Solved

indeed.com's parsed XML data has "&" character missing from url link

Posted on 2008-10-10
6
381 Views
Last Modified: 2008-10-11
Hi, I have developed an app getting indeed.com's XML data to be listed. The funny thing is only one of my client is having this problem, for example the XML data containing link info returned:

The problem data:

http://api.indeed.com/viewjob?jk=59f2ee1649a79789qd=

The normal data should be:

http://api.indeed.com/viewjob?jk=59f2ee1649a79789&qd=

as you can see the character "&" is missing at the end part "&qd=". It is happending to the rest of the line too that should have various "&" to separate the $_GET variables. So I believe only his server settings is causing this problem because I have tested in various different servers from different hosting company without  having this problem. But I need to know what kind of PHP or Apache settings might cause this? The PHP XML functions used are:

      $parser = xml_parser_create();

      $db_data = array();

      xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);

      xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);

      xml_parse_into_struct($parser, $data, $values, $tags);


The PHP version is 5.2.6 (both the server with problem and the ones without the problem)


Thank you.
0
Comment
Question by:santocki
  • 4
  • 2
6 Comments
 
LVL 13

Expert Comment

by:Xyptilon2
Comment Utility
Nothing comes to mind, perhaps a magic_quote setting in php.ini, but I also doubt that.
0
 

Author Comment

by:santocki
Comment Utility
I checked the magic quote settings, but both servers (working and non-working) are set as

magic_quotes_gpc      On      On
magic_quotes_runtime      Off      Off
magic_quotes_sybase      Off      Off


so it's not that problem.
0
 
LVL 13

Accepted Solution

by:
Xyptilon2 earned 500 total points
Comment Utility
I dont think the problem lies in the generation of the XML, how are the URLs formed? What code do you use for that?
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:santocki
Comment Utility
Okay, while I was testing, I was able to narrow down the problem to this code:

   $what = "php programmer";
   $where = "california, ca";

    $xml_url      = 'http://api.indeed.com/apisearch?key='.$indeed_key.

                                                   '&q='.urlencode($what).

                                                   '&l='.urlencode($where).

                                                   '&highlight=false&start=1';


    $data = implode('', file($xml_url));



When I display the $data variable data like

     echo $data

The server with problem will have url having "&" character stripped. So now, the question is, what kind of server settings would affect PHP's file() function to strip out "&" when fetching the remote page?

Thanks.
0
 

Author Comment

by:santocki
Comment Utility
Okay, I have found the solution, there was a problem in the code. Thanks for the assistance.
0
 

Author Comment

by:santocki
Comment Utility
Sorry, I've made a mistake. It still did not solve the problem. If you can help, then I would be glad. I came to narrow the problm at:

    $data = implode('', file($filename));

    echo $data; // >>>>>>>>>> it shows the data with "&" correctly

    $parser = xml_parser_create();

    xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
    xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
    xml_parse_into_struct($parser, $data, $values, $tags);

   print_r($values); // >>>>>>>>>>>> now the "&" is stripped out

I have tried all the xml_parser_set_option() options, but without success. Must be some kind of PHP settings... confused. It only happens in one of my customer's server.

Thanks
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now