PHP - Request To Check:website Changes By Php
Hi
I have a website name www.gentrepid.org I have all the setting scripts for this website in php now as a research part, I am new to this as I havent done that before. I have to make certain changes in the website Include some icons on the left like "Drugs" when user click on it then it shuld direct to search page and then it suld go to a link which shuld move to diffferent website I have attached one sample of Php code which I have. can anybody guide hw to proceed to make changes in the webpage. Similar TutorialsCan you see if a request (post/get) is from a curl request or an actual user? I am trying to defeat a little bit of fraud. Hi all, I've got a website for an event, each team have their details on a page which are recalled from a SQl database. But I'm wanting to create a password input box for each team, so when they enter the correct password they are taken to a page containing forms where they can edit the team details. Here is the page with the users details on where they anter the password: http://www.wharncliffenetwork.co.uk/wrc/entered/team.php?id=8 I'm not sure how to code it, Can an IF statement be used? Anyone got any pointers? I'f been unsuccessful in finding a tutorial or something similar. Hope that makes sense :S Cheers. Doing something wrong, but don't see it. How should one retrieve a POST parameter? My $request->toArray()['html'] works, but I am sure it is not the "right way". <?php namespace App\DataPersister; use ApiPlatform\Core\DataPersister\DataPersisterInterface; use Symfony\Component\HttpFoundation\RequestStack; class ArchivePersister implements DataPersisterInterface { public function __construct(RequestStack $requestStack) { $request = $requestStack->getCurrentRequest(); syslog(LOG_ERR, '$request->getMethod(): '.$request->getMethod()); syslog(LOG_ERR, '$request->getContent(): '.$request->getContent()); syslog(LOG_ERR, '$request->request->get(html): '.$request->request->get('html')); syslog(LOG_ERR, '$request->query->get(html): '.$request->query->get('html')); syslog(LOG_ERR, '$request->get(html): '.$request->get('html')); syslog(LOG_ERR, '$request->toArray(): '.json_encode($request->toArray())); syslog(LOG_ERR, '$request->toArray()[html]: '.$request->toArray()['html']); } } output $request->getMethod(): POST $request->getContent(): {"project":"/projects/1","description":"","html":"<p>{{ project_name }}</p>"} $request->request->get(html): $request->query->get(html): $request->get(html): $request->toArray(): {"project":"\/projects\/1","description":"","html":"<p>{{ project_name }}<\/p>"} $request->toArray()[html]: <p>{{ project_name }}</p> hi, can anyone please check my code it has an error Quote invalid content type for request: application/x-www-form-urlencoded Code: [Select] <?php $request = "<?xml version='1.0'?><request><br> <authentication><br> <username>username</username><br> <password>password</password><br> </authentication><br> <operation>getResellerProducts</operation><br> <params><br> <int>22</int><br> </params><br> </request></myXML> "; $url = "https://testapi.ssl.trustwave.com/3.0/"; // fake - obviosly! $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POSTFIELDS, $request); // what to post curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); $result = curl_exec($ch); curl_close($ch); print $result; ?> thanks! Hi Everyone First off I don't know PHP except the includes statement which I use regularly to make the site a little easier to update. But anyways am having an issue. I am trying to make a standard template page. On a prior site I had it set up this way with the code I will post below and it worked for me but I have tried to implement it on this site and am not having any luck. Few things on the code below. It was designed for another site. So what I need is as follows. The home page should bring up the default index.txt file. That has the home page info on it. Second the code below has a table in the coding as I required a table on my site so that is in the code but for this site don't need the table. There is also one image in the code. That too is no longer required. I will just leave these in place that way you can see the code I am working with so you can hopefully correct it to work for me as I am going nuts trying to get this to work. Also somewhere in the coding it seems maybe there is an open link tag as I did get this to work a little bit but for some reason when it was the TXT file information was also being made to be a link even though the txt file for time being only contains basic text no coding what so ever. Now what I need is as follows. Default home page TXT file loaded when home page loads. But the link below is what I was using for my site and when this was clicked it would load the TXT file for that page so the example link below would open up a members page that was associated with my message board I was using. Code: [Select] <a href="members.php?categories_file=Members">Forum Members Websites</a> that link would bring up file members.txt which was stored in the text folder Below is the code that in both cases was and is placed in the main window of the table I am using for layout. Last time this all worked perfectly but this time not sure why it refuses to load the page like it use to. Can anyways sort this code so it works fine for me. Thanks!! Dave Code: [Select] <?php if ($_GET['categories_file']) $fp = fopen("text/$categories_file.txt", "r") or die("Could not open $categories_file."); while (!feof($fp)) { $line = fgets($fp, 512); $categories[] = $line; } asort($categories) or die("Could not sort array."); $table_column_counter = 0; echo "<table border='0' cellpadding='0' cellspacing='0' width='90%'>"; foreach ($categories as $item) { if ($table_column_counter == 0) { echo "<tr>\r\n"; } $link = explode(",", $item); echo "<td><img src='images/green.gif' width='13' height='13'><a href='$link[1]' target='_blank'>".$link[0]."</a></td>"; if ($table_column_counter == 2) { echo "</tr>\r\n"; } $table_column_counter = $table_column_counter + 1; if ( $table_column_counter >= 2 ) { $table_column_counter = 0; } } ?> hello guys , can you guys see any errors in this code`? i cant seem to find it <?php $units_stats_1 = array(40, 35, 50); $units_stats_2 = array($units_stats_1[0] * 50%, $units_stats_1[1] * 100%, $units_stats_1[2] * 100%); echo $units_stats_2; ?> i allso tryed to do : echo $units_stats_2[0]; thanks I working one paracel SOAP api and im totally crazy already. I need send that code: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://service.core.epmx.application.eestipost.ee/xsd"> <soapenv:Header/> <soapenv:Body> <xsd:businessToClientMsgRequest> <partner>KLIENDIKOOD</partner> <interchange msg_type="elsinfov1"> <header file_id="201805030022" sender_cd="KLIENDIKOOD"/> <item_list> <item service="PA"> <add_service> <option code="ST"/> <option code="SF"/> </add_service> <measures weight="1.000"/> <comment>testcomment</comment> <partnerId>12345</partnerId> <receiverAddressee> <person_name>TEST1</person_name> <mobile>55555555</mobile> <email>itest@test.ee</email> <address country="EE" offloadPostcode="96000"/> </receiverAddressee> <returnAddressee> <person_name>Sender name</person_name> <phone>55555555</phone> <mobile>55555555</mobile> <email>itest@test.lv</email> <address postcode="13811" deliverypoint="Tallinn" country="EE" street="Mahtra 7"/> </returnAddressee> </item> </item_list> </interchange> </xsd:businessToClientMsgRequest> </soapenv:Body> </soapenv:Envelope> If someone have no idea how create php script using SoapClient for that, then im happy to see result! :)
* What i tried is totally shit and didnt worked at all, so i better don't show my code :D I am new to all this, so please help I want to create a request form, basically when I click onto a hyperlink on my web page I want it to call windows explorer with the following ftp;//test.co.uk (example), which will bring up the page and I can log in. Any help would be a much appreciated I'm struggle to build an appropriately formatted URL request for a particular API (not really important which, but it's for Toodledo). The API documentation says: Quote Tasks are edited by POSTing a URL encoded JSON encoded array to the API. Each element in the array will be a task object. You only need to set the fields that you want to set. For efficiency, you should try to send only the fields that have changed. At this time it is not possible to post XML data to Toodledo. http://api.toodledo.com/2/tasks/edit.php?key=YourKey; tasks=[{"id"%3A"1234"%2C"title"%3A"My Task"}%2C{"id"%3A"1235"%2C"title"%3A"Another Task"%2C"star"%3A"1"}]; fields=folder,star I've tried about 100 different combinations of code like the following: $arr = array ('id'=>$id,'completed'=>1,'reschedule'=>1); $tasks = json_encode(array($arr)); $params = array('key'=> $this->key); $params['tasks'] = $tasks ; $params['fields'] = 'id,completed,reschedule' ; $url="http://api.toodledo.com/2/tasks/edit.php?".http_build_query($params) ; $response = file_get_contents($url); None seems to get me to a URL formatted like they ask. Can someone help me out? I'm tired of banging my head against the table. [Note... the fields I'm passing in single element of the $tasks array are different than in the example... but it's the format, not the content, that I can't get right] Thanks in advance! hey guys im tring to look for a good way of finding out if a ajax request is being performed on my page...now ive had a look about and found these two snippets.
Both seems to work fine...any suggestions on what one is best to use or even if there is a better way to do this would be helpful...thank you
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === "xmlhttprequest") { // is ajax } if (strpos($_SERVER['HTTP_ACCEPT'], 'application/json') !== false){ // is ajax } Hi there I'm trying to get an answer for a soap request This is the info provided by the software house about the request: POST /myTest/Services.asmx HTTP/1.1 Host: 127.0.0.1 Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "http://------.--/myTest/Addons" <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <Addons xmlns="http://------.--/myTest/"> <hotelUnit>string</hotelUnit> <initialDate>dateTime</initialDate> <finalDate>dateTime</finalDate> <roomStays> <RoomStayOfPAX> <PaxPerRoom> <PAX xsi:nil="true" /> <PAX xsi:nil="true" /> </PaxPerRoom> <RoomType>string</RoomType> <Allotment> <Allotment>string</Allotment> </Allotment> </RoomStayOfPAX> <RoomStayOfPAX> <PaxPerRoom> <PAX xsi:nil="true" /> <PAX xsi:nil="true" /> </PaxPerRoom> <RoomType>string</RoomType> <Allotment> <Allotment>string</Allotment> </Allotment> </RoomStayOfPAX> </roomStays> <onlyFixedValue>boolean</onlyFixedValue> </Addons> </soap:Body> </soap:Envelope> I'm trying to use this code for the request passing the xml on $parameters $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$baseurl.$command); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_TIMEOUT,180); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $parameters); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($ch, CURLOPT_USERPWD, "$login:$password"); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); $result = curl_exec($ch); if($result === false){ echo 'Curl error: ' . curl_error($ch); } else { //$result = simplexml_load_string($result); } curl_close($ch); return($result); But I get an invalid request. myTest is over a self signed ssl certificate and with basic authentication. Maybe the problem resides there or in the request itself. Anyone can help me with this ? Best regards. Hi, I don't know very much about php. I don't know any at all, actually. I play a game called Roblox where you get to use the programming languange, "Lua" to script your own games. What I am requesting has been done before on this game, but I only know Lua. I was also told PHP cURL is needed. Anyways, let me get to the point. I am essentially trying to create a system on my webserver (You can send HTTP Requests to external sites in this game via script) that will essentially log into an account on Roblox, to perform a task. My current idea would be to have the Lua script send a request to my webserver with an generated code that would access the username and password of my roblox account (Which would be on the webserver). It would then perform a task. Is this a good way to go about this? If not, I am open to suggestions. If you can find the time to actually help me set this up on my webserver, I would greatly appreciate it! I'm also sorry if this is the wrong place for this post, I'm new here. Hello, I am using the send mail form, everything is sent to my mail except the country field, it is sending blank. Code: [Select] $name = $_REQUEST['name'] ; $phone = $_REQUEST['phone'] ; $email = $_REQUEST['email'] ; $country = $_REQUEST['country'] ; $message = $_REQUEST['message'] ; $headers = "From: $email"; $sent = mail( $to, $subject, $name."\n".$phone."\n".$email."\n".$country."\n".$message, $headers); How could it be fixed please? thanks I am very confused at an example in a book I am reading called Beggining PHP regarding XML-RPC requests. I will write the code below: function send($remoteServer, $remotePort, $fullXMLRPCRequest) { $headers = ''; $data = ''; $socket = fsockopen($remoteServer, $remotePort); fwrite($socket, $fullXMLRPCRequest); while ($str = trim(fgets($socket))) { // why doesn't this exhaust the returned call?? $headers .= $str . "\n"; } while (!feof($socket)) { $data .= fgets($socket); } fclose($socket); return $data; } The question I have is notice how there are two while statements and they both access the same resource ($socket). So how can there be two while statements?? Wouldn't the first while statement exhaust the resource and there would be nothing on the second while statement? I hope this makes sense. It's sort of like saying while(x < 10) { //execute... ++x; } then another while statement while(x < 10) { //execute... ++x; } Well then wouldn't the second while statement not execute? I hope I made sense. Thanks for all the help in advance. Obviously knowing XML-RPC would help in answering this question, hopefully most of you are familiar with it. I am using the code below to query a url. It should return the response in xml bu all i get is a string back. $url = 'https://services.example.org/webservices/xget.php?ProductIDValue='.$_GET['pid'].'&ProductIDType=01&ONIXRecordFormat=03&ClientID='.$GLOBALS['user'].'&ClientPassword='.$GLOBALS['pass']; $r= new HttpRequest($url, HttpRequest::METH_GET); $r->send () ; echo $r->getResponseBody() ; 1. How can i get the response as xml 2. How can i display the response on my web page Thanks a lot for your help I'm looking for a way to get the full url of the current page. something like $_SERVER['REQUEST_URI'] but the full thing. request uri doesn't work well for my situation, because my script is in a subdirectory of a domain. http://localhost/script. When I use request uri, it also includes "/script", which it should. Is there anyway to request the full URL? I'm trying to make a League of Legends (a video game) community website, both as a personal project and for practice. Now the game has a lot of champions, each of whom have 5 unique abilities. Now, I thought about manually inputting all the details about each champion into a MySQL database, but that would long and tedious, and I don't really have the time for it now. Also, the game patches very oftern (like, once every 2 weeks) which changes many of the stats, etc. of the champion, and it is not possible for me to keep manually updating these every time there is a patch. Fortunately, there is a League of Legends Wiki which has all the data I need in their specific champion pages, which they keep updated per patch. So I was wondering if there was any way to get the data from the divs in the wiki, and have it display on my site. What I want to do in my website is that whenever someone types a champion's name (in a post or whatever), I want it to display a hover-over dialog with some of the champions details. And a lot of other features such as that. In plain English I need a way to : > Tell PHP to go to the wiki's source code on a specific page > Find a specific div container > Get X data from there > Pass X data into a function to display the hover-over I think this way, I would not have to maintain a database as I can leech off the wiki's data. I have not coded anything like this before, so I would like a few pointers as to how to achieve this. Any help will be appreciated! This part of the question is based off of php so I'll put it here of course. The idea behind this is jquery/ajax is going to get passed an id (eventid) from a dropdown select box inside a form and it's going to run a query to find all the events in my database with that same id. After running the query it's going to list them out and find the highest number of another field (label) and its going to add one to its value and then what I would like for it to is send it back to the form in the jquery/ajax and and place that label inside of the existing input text field in the form. So I'm asking is if my code is presented and is doing what I"m attempting it to do on the php side and if so if I can take out the print tag of the input text field. $eventid = $_GET['eventid']; $result = mysqli_query("SELECT * FROM `events` WHERE `event_id` = '$eventid'"); $list = mysqli_num_rows($result); $label = $list + 1; print '<input type="text" name="label" class="text" readonly="readonly" value="' . $list . '" />'; I am looking for some help parsing the SOAP request below: Code: [Select] try { $aSoapConnectionOptions = array( 'cache_wsdl' => WSDL_CACHE_BOTH, 'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP, 'encoding' => 'ISO-8859-1', 'trace' => 1 ); $client = new SoapClient(WSDL_URI, $aSoapConnectionOptions); $xml = '<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ReceiveData xmlns="GDWebService"> <value> <![CDATA[ <?xml version="1.0" encoding="utf-8"?> <XMLRequest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Description>EventsOnlyListLoad</Description> <Item xsi:type="XMLEventsOnlyRequest"> <RangeStartDate>01/01/2006</RangeStartDate> <RangeEndDate>01/12/2012</RangeEndDate> <ResType /> <ResView>Web Sales Events</ResView> </Item> </XMLRequest> ]]> </value> </ReceiveData> </soap:Body> </soap:Envelope>'; $response = $client->__doRequest($xml,REQUEST_URL,"GDWebService/ReceiveData",'1.1'); When I print out the response, I get the following: Code: [Select] <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><ReceiveDataResponse xmlns="GDWebService"><ReceiveDataResult><?xml version="1.0"?> <ResourceList xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <ResList> <anyType xsi:type="XMLEventsOnly"> <AVAILABLE>0</AVAILABLE> <EVENTNAME>Test Event</EVENTNAME> <RESTYPE>Families</RESTYPE> <TotalBooked>0</TotalBooked> <StartTime>11:00</StartTime> <ID>0069</ID> <EventCode>0000003701</EventCode> <EventDate>30/05/2011</EventDate> <EventDescription> </EventDescription> <Capacity>0</Capacity> <ProductMapID> </ProductMapID> <LongDescription> </LongDescription> <ImageLink> </ImageLink> <MINPERBOOKING>0</MINPERBOOKING> <MAXPERBOOKING>0</MAXPERBOOKING> <ValidFrom> </ValidFrom> <ValidTo> </ValidTo> <AdditionalInfo> </AdditionalInfo> <ValidDays> </ValidDays> <MoreInfoLink> </MoreInfoLink> </anyType> </ResList> <EventsOnly>false</EventsOnly> </ResourceList></ReceiveDataResult></ReceiveDataResponse></soap:Body></soap:Envelope> I want to be able to get the response as an object so I can easily loop through the ResList. Currently, the only way I seem to be able to do this is by doing the following but I know it's not the best code: Code: [Select] $response = str_replace("xmlns=\"GDWebService\"", "", $response); $response = str_replace("soap:Body","body",$response); $response = simplexml_load_string($response); $response = $response->body->ReceiveDataResponse->ReceiveDataResult; $response = simplexml_load_string($response); if($response->ResList) foreach($response->ResList->anyType as $Item){ //echo data here } Hope someone can help. Thanks Hi I got a different and typical (for me) requirement from client. Client have a mobile. He will upload XML file from his mobile to my web address (http://111.111.111.111:8080/directoryname/ In my web address, i have to fetch that request (means take XML file) and insert those details into database by using php. Can anyone tell me how can i do this? |