How can I display the selected value of the option using PHP?
For example I have this code:
<script language=javascript>
function sevent()
{
var xx = document.xx.sbox;
if(document.xx.sbox.selectedIndex != 0)
alert("selected is "+xx.selectedIndex);
else alert("None is selected");
}
</script>
<form name=xx>
<select name=sbox onChange="sevent()">
<option value="default">Select Option</option>
<option value="option 1">option 1</option>
<option value="option 2">option 2</option>
</select>
</form>
Here, it prompts whatever option you select. What I wanted to do is to display
the value of the selected option using PHP. How can do it?
Thanks. ^_^
I am the WikiSysop of my Bikol Thesaurus. I need also other people as
administrator(s) in order to supervise synonym/meaning contributions of users.
And also, users will know who the administrators are. How can i promote a user
as one of administrators?
Thanks guys!
Hi,
I am quite new to this api, and am having some trouble using the mediawiki
api to search for images.
For example, if I am looking for images with title of Palahniuk, I get
different results manually and programmatically.
Manual: If I search on the string "Palahniuk" from the browser at
http://commons.mediawiki.org , I get two relevant image results. However, if
I pass this to an api query, I get zero results:
http://commons.wikimedia.org/w/api.php?action=query&prop=images&titles=Pala…
Can someone help? My primary goal is to get programmatic results for such
queries...
Thanks
Anand
Hi all,
I'm newbie with API but I think that it is useful method to fast request.
I create a simple php to request pages about my wiki but if I use API
method, then my report is:
.. You need read permission to use this module .. API help page ..
I describe better:
* I have got one domain where it works url:
http://genomics.cribi.unipd.it/api.php?action=parse&text={{Category:Tool}}&…
* I have got other domain where I request this url (without final
'fm') into php page (with file_get_contents() function)
* my result is an error about permission and API help page
* instead if I use next url into php page:
http://en.wikipedia.org/w/api.php?action=parse&text={{User:Bilardi}}&format…
* my result is http://en.wikipedia.org/wiki/User:Bilardi page
so that, php page works. I think that I must enable some parameters,
but $wgEnableAPI default value is true.. and if I set
$wgCrossSiteAJAXdomains = '*';
my result is again an error about permission and API help page
Can you help me about this?
Best,
Alessandra.
I'm trying to retrieve all the templates from a page as XML strings so
that I can retrieve their parameters and values. For that I'm using
the "expandtemplates" action with "generatexml" set to true. It works
well for very small articles however not for large ones (above approx.
2000 characters). In this cases, the API fails because the query
string is too big (Error ERR_TOO_BIG).
Is there any way around this issue? Or maybe I'm not using the right
approach? Any help would be appreciated.
Thanks,
Laurent
Has anyone been able to successfully upload a file to any wiki by URL,
*through the API*?
I have been able to get to the point where I get a sessionkey, and then
using "httpstatus" see that the file has been loaded, but it never actually
appears on the wiki (test.wikipedia.org, in this case).
Russ
On Wed, Oct 21, 2009 at 5:18 PM, Russell Blau <russblau(a)hotmail.com> wrote:
> [adding mediawiki-api since this seems to be more relevant to that list]
>
> "Bryan Tong Minh" <bryan.tongminh(a)gmail.com> wrote:
>>On Wed, Oct 21, 2009 at 4:29 PM, Russell Blau <russblau(a)hotmail.com> wrote:
>>>> --abc
>>>> Content-Disposition: form-data; name="%s"; filename="%s"
>>>> Content-Type: application/octet-stream
>>>>
>>> What is the second "%s" in the above line? Is this instead of having a
>>> separate form-data element with name="filename", or is it a duplicate of
>>> that element, or is it something entirely different?
>>>
>>name is the name of the form element (wpUploadFile) and filename the
>>name of the file (picture.jpg)
>>
>>> If RFC 2388 says that the sending application MAY supply a file name, why
>>> is
>>> the API treating this as a REQUIRED parameter?
>>It is not, as far as I can see. It is requiring the form element
>>"filename" and ignoring the filename attribute from the file all
>>together.
>
> So, basically, the API for action=upload is (a) not compliant with RFC 2388,
> and
It simply discards the filename attribute. RFC 2388 only specifies
client side behaviour; it does not state whether or not the server
application should do with it. My personal preference is to have
filename sent along explicitly [as form field, not as parameter to the
file part].
> (b) failing with a misleading error message when the client fails to
> supply a parameter that isn't used at all?
In case the filename is not sent along as form field, it will reject
the upload with the error (missingparam, filename) [which is not what
the topic started got as error].
In case the filename is not sent along as file part parameter, the API
does not throw an error, unless intermediate layers [such as PHP or
Apache] strip the entire file in case no filename is specified. I do
however not believe that this is the case, although I have not tested
it myself.
The problem of the topic started was caused because he was simply
sending malformed data.
Regards,
Bryan
2009/10/21 Russell Blau <russblau(a)hotmail.com>:
> So, basically, the API for action=upload is (a) not compliant with RFC 2388,
> and (b) failing with a misleading error message when the client fails to
> supply a parameter that isn't used at all?
>
Neither of these is true. The filename parameter specifies the name of
the file ON THE WIKI, like the second textbox in Special:Upload does.
Roan Kattouw (Catrope)
Hello,
I want to use in my tool the new "Upload API".
I call (after login):
$new_file = <Name of the target file>;
$file = <URL of the source file>;
$desc = <Description>;
$this->server = 'commons.wikimedia.org'
$connect = fsockopen ($this->server, 80, $err_num, $err_str, 10);
$token = $this->get_token(); //Works
$message =
"filename=".urlencode($new_file)."&token=".urlencode($token)."&url=".$file."
&comment=".urlencode($desc);
if( $connect ) {
$query = "POST /w/api.php?format=php&action=upload HTTP/1.1
Host: ".$this->server."
Cookie: ".$cookies."
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7)
Gecko/20041107 Firefox/1.0
Content-Type: application/x-www-form-urlencoded
Content-Length: ".strlen($message)."
".$message."
\r\n\r\n";
fputs ($connect,$query);
The answer is: array(1) { ["upload"]=> array(1) { ["upload_session_key"]=>
int(<ID, e.g. 2095449403>) } }
But the file isn't uploaded. What do I wrong?
Viele Grüße
Jan
This is a bit funny.
http://en.wikipedia.org/w/api.php?action=query&list=embeddedin&eititle=Temp…
Note the zero value for the limit.
The return value is as follows. The container is empty, which is okay
as far as it goes.
<?xml version="1.0"?>
<api>
<query>
<embeddedin />
</query>
<query-continue>
<embeddedin eicontinue="10|Stub|1922147" />
</query-continue>
</api>
But note the query-continue element in the response. The result of
calling the API again with the eicontinue attribute above as a
parameter is of course an identical response. This could lead naively
written client code into an eternal loop of repeated API calls.
I'd expect an error to be thrown here. Perhaps an API call with a
limit of 0 should really be treated as invalid and an api error code
should be returned, or perhaps it should be treated the same as a
negative limit, which currently seems to return an empty body with no
query-continue element.