How to call that URL in php, so that I get the report for any ID number or title I search? Either the ID number or the title will be empty in the URL based on what the user searches. The user ID and password is the same for all users.
I am not sure if I explained myself well, but I hope I could get some help from here.
Thanks in advance
Last edited by Atrisa Milani; 01-09-2013 at 02:28 AM.
Thank you both for your answers. I hid the username and password data from the URL.
The report comes from an API and not from HTML page. In my case I guess the file_get_contents function will work fine, though I am still not there
You can access those variables in PHP quite easily using $_GET.
So, for example, if that url is used on a page to run the search, we could use code such as the following...
mysql_query("SELECT * FROM mytable WHERE id=$id OR myvar='$myvar'");
BE SURE TO CLEAN/VALIDATE YOUR VARIABLES BEFORE USING THEM IN A SQL QUERY TO AVOID INJECTION.
One question yet: the report is using Scandivian characters such as Å and Ä. The report looks fine on the URL in the browser, but when I get the same report with my PHP code, those special characters are not recognized and the report looks funny. Is there a way I could define the character set in my code so that the report shows correctly?
Also the styles and pictures in the report are missing.
Last edited by Atrisa Milani; 01-18-2013 at 07:55 AM.
If your database query is not pulling the information you would expect, there are several factors:
1. table structure
2. how the variables are encoded in the table
3. how the variables are encoded in the query
If you are using the code I suggested, then Å will be changed to Å when stored in the variable (or, perhaps displayed in the report depending on how you have it set up). To reduce the risk of SQL injection it's important to use htmlentities() or something similar when using the variables in a query. However, if you need these characters displayed on the screen, you could use: