Solved

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

Posted on 2008-10-10
6
405 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 13

Expert Comment

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

Author Comment

by:santocki
ID: 22693805
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
ID: 22693824
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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 

Author Comment

by:santocki
ID: 22694180
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
ID: 22694224
Okay, I have found the solution, there was a problem in the code. Thanks for the assistance.
0
 

Author Comment

by:santocki
ID: 22694331
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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
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 create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

696 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