Empty value of GET parameter in zend framework - php

I'm using zend framework in my site. URI address one of the page is:
http://mysite.com/controller/action/no/123/date//email//
I expect to obtain the next GET parameters and values:
no=>123
date=>
email=>
It's true on localhost but on the web hosting on obtained:
no=>123
date=>email
It looks like empty values was missed. What can be a reason for this and how I can it fix?

You have issue there is routes have done like first is key and next is value so, in your url have two blank space. change in url something line below.
try like this
http://mysite.com/controller/action/no/123/date/email/

Related

Drupal/Twig/Symfony Routing Returns "null" for base_url

I have been researching for almost 2 weeks on for an answer and have finally decided I needed to ask for help. I am quite unfamiliar with PHP/Drupal but has inherited such a project to update and maintain. The project runs on Drupal 8.3.7 and is hosted with IIS 6.2.
For some unknown reason, links in my html.twig files are being returned with a "null" base_url. So for example...
...
will link to "null/home" ... After a lot of hacking and trying to figure out if I could manually set $base_url (not a best practice, I know, but I just needed to see if it was possible), I found two peculiar behaviors:
A. If in the associated controller I create a variable $temp_base_url and hardcode the value "localhost" and attempt to put the following in my html.twig file (where item.url = "/home")...
http://{{temp_base_url}}{{item.url}}
The text between the anchor tag will show up correctly as http://localhost/home while the actual link will direct you to null/home .
B. On the other hand, if I assigned $temp_base_url to equal "http://localhost" and put the following code...
{{temp_base_url}}{{item.url}}
The text between the anchor tag will (aga) show up correctly as http://localhost/home while the actual link will now try to direct you to http://localhost/null/home .
The problem isn't with the global variable $base_url because when I test for this within the Controller, $base_url is setting itself correctly to "localhost" so I suspect Symfony or something else rendering the routes incorrectly (any attempts to use 'path' or 'url' has also resulted in similar null issues).
So my question is: Where are these nulls coming from? How do I get IIS/Drupal to pick up the appropriate base url for routing?
You can use this url('<front>')
{{ url('<front>') }}{{item.url}}

Webex: How to list hosts meetings

Using PHP I need to get a list of company webex meetings and show them on web page
I tried the code on this page: https://developer.cisco.com/site/webex-developer/develop-test/xml-api/sample-code/
But that failed.
<serv:header>
<serv:response>
<serv:result>FAILURE</serv:result>
<serv:reason>Failed to get SiteUrl</serv:reason>
<serv:gsbStatus>PRIMARY</serv:gsbStatus>
<serv:exceptionID>010000</serv:exceptionID>
</serv:response>
</serv:header>
<serv:body>
Error message was that it could not find the SiteURL. The siteurl I was using is companyname.webex.com - when I put that url into browser, it goes to our webex page, so it seems to be correct.
I found this: http://joshuamcginnis.com/webex/ and tried it (using real credentials), but it gives a 500 error and I have no access to logs.
Both of these examples are very old and I am struggling to find up-to-date examples.
If I put https://company.webex.com/WBXService/XMLService into browser, I get a success message
Can anyone suggest how to do this in either PHP or javascript
According to the PHP example in the link, you must be using something like:
<securityContext>
<webExID>YourCiscoUsername#example.com</webExID>
<password>YourCiscoPassword</password>
<siteID>243585</siteID>
<partnerID>g0webx!</partnerID>
</securityContext>
Try using the "siteName" instead of "siteID", like the following:
<securityContext>
<webExID>YourCiscoUsername#example.com</webExID>
<password>YourCiscoPassword</password>
<siteName>go</siteName>
<partnerID>g0webx!</partnerID>
</securityContext>
You can use siteID or siteName indistinctly, but looks like that siteID isn't working for that demo site right now. Their Java and .Net examples are using siteName.
Now, you have to use "go" in siteName if you are making the request to https://go.webex.com/WBXService/XMLService
But you must use "apidemoeu" if you are making the request to
https://apidemoeu.webex.com/WBXService/XMLService
They both appear to be demo sites.
And effectively "Failed to get SiteUrl" is the error returned if the value passed in either siteName or siteID doesn't correspond to an existing site.

How can I get array from GET request?

I have a trouble:
I have url of view:
?materials=1&materials=2&materials=3&materials=4&materials=5&materials=6
How can I get it in array throw Yii mechanism?
Yii::app()->request->getParam('materials')
Not working
$_GET['materials']
Too not working
Url is static and can not change
This URL was created https://github.com/Mikhus/jsurl plugin
PHP automatically parses parameter as an array, if it ends by []. (i.e. ?materials[]=1&materials[]=2&materials[]=3&materials[]=4&materials[]=5&materials[]=6) Otherwise you can parse query string manually to solve your issue. Look at this

Using multiple nested _GET variables in a single URL

Setup:
Script that generates word images from multiple letter images
(autotext.php)
URL is formatted:
www.whatever.com/autotext.php?text=hello%20world
Script that alters images server-side to run filters or generate
smaller sizes (thumbnail.php)
URL is formatted:
www.whatever.com/thumbnail.php?src=whatever.png&h=XXX&w=XXX
Use-case:
I want to generate a smaller version of the autotext server-side. So my call would look something like:
www.whatever.com/thumbnail.php?src=autotext.php?text=hello%20world&h=XXX&w=XXX
As you can see, I would like to treat a URL with _GET variables as a variable itself. No amount of playing with URI encoding has helped make this work.
I have access to the PHP for both scripts, and can make some simple alterations if that's the only solution. Any help or advice would be appreciated. I would not even rule out a Javascript frontend solution, though my preference is to utilize the two scripts I already have implemented.
You should be able to do this by urlencoding all the $_GET params into a variable then assigning that variable to another, like this (untested):
// Url generation
$url = www.whatever.com/thumbnail.php?src=(urlencode(http_build_query($_GET)));
Then you should be able to retrieve on other side:
$src = urldecode(explode('&', $_GET['src']));
I've seen this exact behavior when trapping where to redirect a user, after an action occurs.
---- Update ----
Your "use case" url was correct:
www.whatever.com/thumbnail.php?src=autotext.php?text=hello%20world&h=XXX&w=XXX
.... except that you CANNOT have more than one ? within a "valid" url. So if you convert the 2nd ? to a &, you should then be able to access $_GET['text'] from the autotext.php script, then you can urldecode it to get the contents.

PHP: Sending a request and getting a response

I'm from ASP.NET MVC background and this is first time I'm trying to write something in PHP.
In ASP.NET MVC we can develop models for our data and using the actions that we write we can get them or send them to another action. What I mean is that
public ActionResult Login_Action(LoginModel _Model) {
// Authenticating the user
return RedirectToAction(X);
}
when calling this the url that is shown in the address bar (in case of using GET, if it is POST nothing will be shown after the page name) will be:
www.WebsiteX.com/Login?Username=something&Password=something
The problem is that I don't even know how search for this in google (like by typing what exactly) because in Microsoft side, these are handled automatically the way I described.
But in case of PHP, how can I get the values in the address bar? do I have to get the actual address and then break the values down into arrays?
I'd appreciate any help.
First of all, this seems to be invalid for me: www.WebsiteX.com/Login?Username=something?Password=something The first parameter need to be ? and the others should be &.
Second: You can get your values of your parameters by accessing the $_GET global array.
Eg. for the username echo $_GET["Username"];
Are you using any framework? You should. And then, the Framework will give you the way to do that. In ASP.NET you use a Framework so do the same in PHP.
With vanille PHP you can get the GET values with $_GET['Username']. But please, use a framework.
I think that the most popular are Laravel and Symfony right now.
Example:
In laravel you can bind a parameter to a variable so you can do something like:
//Url: mywebsite.com/user/1/
Route::get('user/{id}', function($id)
{
return 'User '.$id;
});
Which is similar with the ASP.NET example.

Categories