A strange problem is happening on my site . I want to get JSON data from query string so I request a url something like this http://myurl.com/?get_json.php={"created":"now"} but this gives me a 404 error . But the other query string works just fine I mean when I add {" : "} this permeter the url does not work. I am pretty sure this a problem in my server side configuration beacause when I try the same url in other site from different hosting the url just works fine . How can I configure my site to get this work?
Not working https://altahleel.com/new.php?order=%7B%22created%22%3A%22-%22%7D but this is working https://dainikalorprotidin.com/t.php?ts=%7B%22created%22%3A%22-%22%7D
before redirect to url parse with url_encode($url)
Related
I'm facing a strange behaviour while working with a web-service.
Most of the URLs send me back a correct json response even if I work with urlencode().
So, for example, if I use http://mywebservice/?q=json_themes_abc%2F254 or http://mywebservice/?q=json_themes_abc/254, I'll get the same response.
But, only for one type of request, http://mywebservice/?q=json_demarches/2808 works and not http://mywebservice/?q=json_demarches%2F2808.
It happens only with ?q=json_demarches requests.
Does someone have a clue? Is the problem in my side or their? I read something about turning on “AllowEncodedSlashes” directive in their Apache but wouldn't be a general issue with all their URL if so?
Thanks in advance.
I'm trying to get page content by URL (e.g. 'http://example.com/page.html') using PHP, but remote server redirects it to another page (e.g. 'http://example.com/another-page.html') and when I try to execute code:
$p = file_get_contents('http://example.com/page.html');
echo $p;
browser returns 404 error:
The requested URL /another-page.html was not found on this server.
As I understand, instead of getting 'http://example.com/another-page.html', PHP tries to return 'another-page.html' from my localhost and of course there is no such page. Seems like remote server redirects using local address ('/another-page.html' instead of 'http://example.com/another-page.html') which is correct of course, but I don't know how to deal with it.
Could anybody advise me, how could I solve this problem?
Thanks in advance
I am working with the Yii Framework.
In a controller, after a model save, I'm trying to redirect the user to /module/controller/action and set a parameter (redirectUrl) to another URL. Here is my code:
$this->redirect(array('/module/controller/action/', 'redirectUrl'=>'/index.php/some/url/id/'.$id));
This seems to work well as I am redirected to:
http://localhost/index.php/module/controller/action/redirectUrl/%2Findex.php%2Fsome%2Furl%2Fid%2F11
But when I get there I get the following error:
Not Found
The requested URL
/index.php/module/controller/action/redirectUrl//index.php/some/url/id/11 was not found on this server.
The URL like /index.php/module/controller/action/redirectUrl/1234 works fine.
I don't understand what I am doing wrong here, URL seems to be correctly encoded. Any idea would be of great help!
Thanks
Your example URL is only passing 1234 as the parameter, not a full relative URL, e.g. /index.php/some/url/id/1234. I think what you want is:
$this->redirect(array('/module/controller/action/', 'redirectUrl'=>$id));
You could skip the URL rules on your server and minimally reduce load with:
$this->redirect('/module/controller/action/redirectUrl/' . $id);
$this->redirect($this->createUrl('/module/controller/action/',
array('redirectUrl'=>'/index.php/some/url/id/'.$id));
If this does not work do
$this->redirect($this->createUrl('/module/controller/action/',
array('redirectUrl'=>$id));
and then just add '/index.php/some/url/id/' in the action.
http://www.yiiframework.com/doc/api/1.1/CController#createUrl-detail
There is an issue with url sending from a url variable to php file. The first url showing 404 error while second one is working fine.
http://example.com/fix/ajax/linksave.php?li=http%3A%2F%2Fmail.google.com%2Fma&st=14&ty=3&tl=test&ip=117.219.231.12
http://example.com/fix/ajax/linksave.php?li=hy&st=14&ty=3&tl=test&ip=117.219.231.12
so when variable "li" want to send a url it always showing 404 error.
While sending url string use php's urlencode() . For more info refere http://php.net/manual/en/function.urlencode.php .
I've developed an application, using LAMP, and everything works fine, after migrating over to IIS, some pages don't work correctly.
I have a service_edit.php, which carries over URL parameters from the previous page, e.g.:
service_edit.php?id=5&serv=22
After updating the record, the following variable should redirect the browser to:
$updateGoTo = "freelancer_details.php?id=" . $row_rsFreeLancer['freeid'] . "";
But the browser produces a HTTP 500 error with service_edit.php?id=5&serv=22 in the address bar.
If I use:
$updateGoTo = "freelancer_list.php;
Everything works fine.
Does anyone know what I'm doing wrong, or if there is a setting in IIS to get this to work?
EDIT
OK, getting a bit closer to the problem now...
I've found that on my LAMP server, after the record has been updated, the page goes back to the freelancer_details.php page, with the correct details displayed, however, the parameters from the previous page are carried over too.
The URL, instead of displaying:
freelancer_details.php?id=5
displays:
freelancer_details.php?id=&id=5&serv=22
How do I remove the URL parameters from the previous page, so the URL displays correctly, and therefore work on the IIS server?
I can't say specifically what the problem is from what you have here (it's hard to understand what you're saying without seeing the rest of the script), but I can almost guarantee that IIS isn't the problem. Most likely there is some confusion with the page you are trying to forward to - either it's not there, or not being forwarded properly.
Try doing this:
$updateGoTo = "freelancer_details.php?id=" . $row_rsFreeLancer['freeid'] . "";
echo("<a href='".$updateGoTo."'>Click Me</a>");
and try clicking. That will tell you if there is truly a page at that URL, or if it's off.
Also, how are you forwarding to the next page? Are you using header() or something else?
Edit
Hi,
What this means ?id=&id=5 is that instead of having $_GET['id'] available as 5, it will be an array with two values, one of which will be blank, and the other will be 5.
You need to figure out why the id is being added twice and fix that. Without code, I can't tell you much else.
If it is a DEV box, go in the IIS and/or IE and remove the "Friendly http error" that way, you should get a more verbose error message.