PHP - Soap Request Initialization Is Taking Too Long To Execute
The SOAP request initialization is taking too long to execute. We have analyzed the system and application logs which suggest that the issue resides with SOAP request initialization.
We are using PHP5.3 to call .net web service using SOAP. Please suggest. Similar TutorialsHi All, Long question but I hope someone will be able to point me in the right direction. At the moment I am writing a cricket management game and and each hour each team is updated with the code Code: [Select] <?php #Players MUST be updated from this screen so they cna get team bonuses $teamUpdateTime=$team['teamUpdateTime']; #This is the time that the team is updated $teamMorale=$team['morale']; #Get the teams morale while($teamUpdateTime<$updateTime) { #Keep looping through this until we are up to date echo "<BR>".$team['name']; #Work out changes to team morale if($teamMorale>1000) $teamMorale -= mt_rand(0, 3); #If team morale is high then lower it if($teamMorale<1000) $teamMorale += mt_rand(0, 5); #If team morale is low then increase it $moraleBonus=0; #Reset the variable $confidenceBonus=0; #Reset the variable $injuryBonus=0; #Reset the variable $energyBonus=0; #Reset the variable $teamUpdateTime += 3600; #Add an hour to the time include("hourly_update_player.php"); #Do players now } #Save the team $sqlTeam = "UPDATE teams SET morale='$teamMorale', teamUpdateTime='$teamUpdateTime' WHERE teamID='{$team['teamID']}'"; if(!mysql_query($sqlTeam, $sqldb)) die('Error: ' . mysql_error()); //Update the record, if there is an error then show it ?> the line include("hourly_update_player.php"); #Do players now then activates the following code Code: [Select] <?php #Playeres will have to be updated with the team because we have to check for team medic $players = mysql_query("SELECT playerID, name, injuryTime, energy, morale, confidence, fitness FROM players WHERE teamPlayedFor='$team[teamID]'"); #Get all the players of the team while($player = mysql_fetch_array($players)) { #Go through all the players of the team echo "<BR>".$player['name']; # Do all the updating of player stats here. I won't put the full code here as it is not needed for the question on phpfreaks. $sqlPlayer = "UPDATE players SET energy='$energy', confidence='$confidence', morale='$morale', injuryTime='$injuryTime' WHERE playerID='{$player[playerID]}'"; #Update player if(!mysql_query($sqlPlayer,$sqldb)) die('Error: ' . mysql_error()); //Update the record, if there is an error then show it } ?> Each team has around 25 players to update. With ten teams (250 players all up) in the game (the game is still pre-alpha) to test it all this takes 8 seconds to go through all the teams and their players. Unfortunately in this 8 seconds nobody else can use the database as it locks it up. I tried to have the players update by itself (so it only has to go through the players database once) but cannot work out how to have team affects on the player - for example if the team has a specialist batting coach then the player gets an extra batting point each hour so it needs to go through the teams first. MY QUESTIONS A) How can I speed this up? When the game goes into the public domain I would like to see around 1-5 thousand teams, this could take up to 800-4,000 seconds - waaaay to long. B) When it is updating the database I can't play the game, it simply says loading until the updates are finished and then continues as normal; with thousands of teams I do expect a bit of delay but how can I keep parts of the database open that aren't being used? C) Each time I go through a team the players database is reloaded, can JOINS fix this? Or is there another way of doing this? Hey, all... Hoping someone can point me in the direction to get this script to execute a little quicker (looking for several seconds to be shaved). I've got a script that takes info from a form, dumps into a DB, then runs a shell command (custom app) that takes the info from the DB, puts it into a specific (and different for each client) spreadsheet, gets some other values, and puts those in the database. When i execute the command from a cmd prompt, it finishes in less than a second. However, when I run it from PHP, it takes anywhere from 9 - 15 seconds to get to the next page. I've watched it in task manager, and the file i'm running is open for "what appears to be" the entire length of time before the results page appears (although, i realize that technically it's not). why could it be taking so much longer from PHP than it does from the CLI? can you think of a way to get it to run quicker? I don't think it's a PHP coding issue, but more of a permissions issue, but I can't think of anything else to try at this point... 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 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. We are trying to develop a Flight Reservation System. It communicates with a remote server using non-wsdl mode. The remote server requires a couple of ID's in the header. But whenever we try to connect to this server using the PHP Soap Client, it throws an error showing :- Fatal error: Uncaught SoapFault exception: [SOAP-ENV:Server.Exception:] Error occurred while trying to invoke requested method. in C:\xampp\htdocs\soap\two.php:41 Stack trace: #0 C:\xampp\htdocs\soap\two.php(41): SoapClient->__soapCall('getAvailability', Array) #1 {main} thrown in C:\xampp\htdocs\soap\two.php on line 41 Please let me know your thoughts on this and some inputs on executing SOAP requests. Thanks in Adv. Sam Hi, I am attempting to download a report from Bing Ads, and am having issues with the level of nesting on the SOAP request for the date, (specifically 'Time' = >....) Definitely appreciate the help! SOAP elements can be found at https://docs.microsoft.com/en-us/advertising/reporting-service/date?view=bingads-13 for date and https://docs.microsoft.com/en-us/advertising/reporting-service/reporttime?view=bingads-13 using CustomDateRangeStart and CustomDateRangeEnd $request = [ 'ReportRequest' => new SoapVar( [ 'Format' => 'Csv', 'ReportName' => 'Bing Keyword Performance Report', 'ReturnOnlyCompleteData' => false, 'Aggregation' => 'Daily', 'Sort' => ['SortColumn' => 'Clicks'], 'Sort' => ['SortOrder' => 'Ascending'], 'Scope' => [['AccountIds' => [...]], ['CampaignId' => null], ['AdGroupId' => [...]]], 'Time' => ['CustomDateRangeStart' => ['Date' => ['Day' => $startDay],['Month' => $startMonth],['Year' => $startYear]]], 'Time' => ['CustomDateRangeEnd' => ['Date' => ['Day' => $endDay],['Month' => $endMonth],['Year' => $endYear]]], 'Filter' => ['BidMatchType' => [$mt]], 'Keywords' => array($criteriaValue), 'Columns' => [ "TimePeriod", "Spend", "Clicks", "CurrentMaxCpc", "Impressions", "AverageCpc", "TopVsOther", "QualityScore", "CampaignStatus", "AdGroupStatus", "BidMatchType", "AdGroupName" ] ], SOAP_ENC_OBJECT, 'KeywordPerformanceReportRequest', "https://bingads.microsoft.com/Reporting/v13" )]; Edited March 8, 2020 by Mike1020 Added a link for ReportTime data object Hello, This is supposed to be a sample soap request. I don't know how to actually send the request with php. Code: [Select] POST /sendSms.asmx HTTP/1.1 Host: host_site.com Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "http://some_uri.com/sendSms" <?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> <sendSms xmlns="http://some_uri.com/"> <username>string</username> <password>string</password> <smsContent> <string>string</string> <string>string</string> </smsContent> <cell> <string>string</string> <string>string</string> </cell> <from>string</from> </sendSms> </soap:Body> </soap:Envelope> How am I supposed to so send this info? What is soapAction there? I tried: Code: [Select] $client = new SoapClient("host_site.com/sendSms.asmx"); and I'm getting: Quote Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'host_site.com/sendSms.asmx' : Premature end of data in tag html line 3 in ... 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
I am working with myDHL API and not getting a null response from their API. When i look into the fault code its showing an env:server. Their support is not helpful so need some help here. I tried using the Soap class using the code below $request=<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" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> <soap:Header><wsse:Security soapenv:mustunderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> <wsse:UsernameToken wsu:id = "UsernameToken-5" xmlns:wsu = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" > <wsse:Username > test</wsse:Username > <wsse:Password type = "PasswordText" >test</wsse:Password> <wsse:Nonce encodingtype = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" > eUYebYfsjztETJ4Urt8AJw ==</wsse:Nonce > <wsu:Created > 2020 - 04 - 24 20:17:21 </wsu:Created > </wsse:UsernameToken > </wsse:Security > </soap:Header> <soap:Body> <ShipmentRequest xmlns="http://scxgxtt.phx-dc.dhl.com/euExpressRateBook/ShipmentMsgRequest"> <MessageId xmlns="">c68d7150bbd611e2b09ad103c98eed12</MessageId> <ClientDetail xmlns=""/> <RequestedShipment xmlns=""> <ShipmentInfo> <DropOffType>REGULAR_PICKUP</DropOffType> <ServiceType>P</ServiceType> <Account>4324324324</Account> <Currency>EUR</Currency> <UnitOfMeasurement>SI</UnitOfMeasurement> </ShipmentInfo> <ShipTimestamp>2019-10-24T14:01:22GMT+00:00</ShipTimestamp> <PaymentInfo>DDU</PaymentInfo> <InternationalDetail> <Commodities> <NumberOfPieces>1</NumberOfPieces> <Description>Documents</Description> <CustomsValue>10</CustomsValue> <CountryOfManufacture>ES</CountryOfManufacture> </Commodities> </InternationalDetail> <Ship> <Shipper> <Contact> <PersonName>Karlos Espana</PersonName> <CompanyName>SHIPING LTD</CompanyName> <PhoneNumber>3848211</PhoneNumber> </Contact> <Address> <StreetLines>DEL STREETO 9</StreetLines> <City>SANT CUGAT DEL VALLES</City> <PostalCode>08173</PostalCode> <CountryCode>ES</CountryCode> </Address> </Shipper> <Recipient> <Contact> <PersonName>Martin Soltys</PersonName> <CompanyName>DHL</CompanyName> <PhoneNumber>731731731</PhoneNumber> </Contact> <Address> <StreetLines>V Parku 2308/10</StreetLines> <City>Prague</City> <PostalCode>14800</PostalCode> <CountryCode>CZ</CountryCode> </Address> </Recipient> </Ship> <Packages> <RequestedPackages number="1"> <Weight>1</Weight> <Dimensions> <Length>35</Length> <Width>25</Width> <Height>1</Height> </Dimensions> <CustomerReferences>LC MAGIC NUMBER 0037</CustomerReferences> </RequestedPackages> </Packages> </RequestedShipment> </ShipmentRequest> </soap:Body> </soap:Envelope>
$url = 'https://wsbexpress.dhl.com:443/sndpt/expressRateBook'; $action = 'createShipmentRequest'; try { $client = new SoapClient($path_to_wsdl); $response =$client->createShipmentRequest($request); } catch (SoapFault $fault) { echo "<h2>SOAP Fault!</h2><p>"; echo "FaultCode: {$fault->faultcode} <br/>"; echo "FaultString: {$fault->faultstring} <br/>"; echo"</p/>"; }
Hi guys, Im trying to work with a wsdl which allows me to login and sends back a token (cookie) in the response. Whenever I strip out the token and the use __setCookie to set the cookie for future requests all other requests will not authenticate... Anyone any ideas please? Im really at a loose end... Heres the code Im using... Code: [Select] <?php ini_set("soap.wsdl_cache_enabled", "0"); $url = "some.wsdl"; //$url = "http://ws.some.com/services/some?wsdl"; $soap = new SoapClient($url, array('trace' => true)); // try 3 times to login for($i = 0; $i < 3; $i++){ try{ $result = $soap->opLogin(array('name' => 'username', 'cleartext' => 'password')); $token = $result->info; $token = trim(str_replace("PubAuth1=", "", $token)); // Print token echo "token - cookie:"; print($token); echo "<br>"; // Set cookie //$soap->__setCookie('PubAuth1', $token); createSession(); // Retry loopje for($i = 0; $i < 3; $i++){ try{ // This is the second call which will not authenticate.... $result2 = $soap->__soapCall("opSetUser", array("email" => "me@you.com", 'p' =>'password123')); // Print result echo "opSetUser result: "; var_dump($result2); exit; } catch(Exception $ex){ echo "opSetUser error: " . $ex->getMessage() . "<br>"; } } } catch(Exception $ex) { echo "opLogin error: " . $ex->getMessage() . "<br>"; } } ?> THanks in advance. Davy Hello, I need to execute a remote web page (distant server) every X seconds. How is it possible and is there any way to make it look exactly like a normal user request through a standard browser like Firefox, Chrome, etc. ? I've heard of cURL, but it seems that servers may block it, so there must be somehow a difference between a usual user request and a cURL execution. Thank you for any help ! :-) Matthew hello, I have this problem in running a specific command after using shell_exec or exec to execute a certain process. The process I am running is unimrcpclient, after initialization, it expects some command to be entered in order to communicate with the mrcp server. however, passing the command as an attribute is not an option. Is there a way in PHP to execute a process, wait for initialization and then pass the command automatically? thank you. 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> I'm trying to get details of family members to display in a grouped fashion under their family, but for some reason the cell phone (mobile phone) number comes through from the query but not into the variable assignment!? I've used FirePHP to track the variable assignments and I can see that the value pulls into the query variable $per_Cellphone but not through into the array as it outputs a NULL value!? The Email works fine, just not CellPhone? $aCellPhone[$iCount] = $per_Cellphone; $aEmail[$iCount] = $per_Email; Hello, Is there any way to capture a screenshot of a full length view of a website using php on a shared hosting linux server? After many, many years of struggling, I would like to finally learn how to separate my website's PRESENTATION from its LOGIC. I have been working on a startup business for over a decade now. And one of the reasons it is taking me so long to build my website from scratch is because I am a horribly INEFFICIENT PROGRAMMER!! On one hand, I think I write solid business logic. But considering that each of my scripts averages between 1,000-2,000 lines of code, that is a monster to manage. (My website is over 50,000 lines of code at this point. All home-grown and hand-coded.) While it is hard to manage things while I am actively coding, what kills me even more, is when I get pulled away for months (or recently for 2 years), and then later on when I come back, it is a nightmare to load all of that code into my brain?! I mean if you read any of my scripts starting at line 1 and going through line 1,500 I think it reads pretty well. But who in the hell can keep track of all of that in one reading? It's certainly a struggle for me!! I definitely wantto strive for more of a "component archtecture" approach. (On a side note, I have heard "good" Object-Oriented programmers claim that if a class is more than 100 lines of code then it is too long?!) So anyways.... My #1 priority for v2.0 is to learn and master separating my website's PRESENTATION from its LOGIC using something like MVC. (And after that, my goal is to finally learn and master Object-Oriented Programming, but one thing at a time!!) I want to finally learn how to program like a *professional* coder. (A very successful and RICH professional programmer!!!) ? So, can all of you gurus out there, please help me get started with a solid Model-View-Controller introduction and/or resources and/or advice?? I know the Internet is littered with this topic, but like anything done well, you need to find good learning materials and at least one or two good mentors. After all, if MVC and OOP and whatever were so easy, then everyone would be doing it, and doing it well. (And of course you realize that very few people actually do things like MVC and OOP well!!) So my goal is to become a "jedi", but I will need some good teachers to get there...
Edited February 24, 2019 by SaranacLake Type-o's and added some more stuff... I have just recently began learning PHP. I have a pretty solid foundation in general programming and PHP. As my first major PHP project I am trying to make myself an autobuyer for Fifa 15 using curt2008 Fifa API. He basically has everything there for me to use and I know that I have enough knowkledge to get a basic autobuyer going if I could just figure out how to log in. I have come to realize that the problem is that I have no idea what he is doing when he connects to the Fifa Web App. He has the code there for me, but I don't know what it is actually doing. I was hoping someone can point me to some documentation, a tutorial, or even exercises so that I may learn more about... logining into a web application? I don't even know what to call it.
Looking at connect.php he has a bunch of functions. Login, getSessionID, Phishing, getNucleusID, getShards, and all of them do a bunch a requests and use a bunch of headers. I don't know what this terminology is or how it all works together, but I would like to learn about it. Thats why I wanted to start learning PHP, for stuff like this. I just don't know where to look.
Thank You
I am using this code in my "create_account.php" script... Code: [Select] mail($trimmed['email'], ' Please Activate Your Account', $body, 'From: admin@mywebsite.com <admin@mywebsite.com>'); It is taking anywhere from one to several hours to receive this e-mail in my inbox?! It used to take seconds, and now takes forever. I thought it was a Gmail or SPAM issue, but I just did a test on my AT&T paid account and the same issue so far... It's awfully hard to do development and testing if I have to wait a half-a-day to get these e-mails?! Debbie I am trying to adapt a database search form from a tutorial I saw, and it's not working. I just get a blank white slate despite having error_reporting(E_ALL); at the top of the page. I was hoping someone might be able to spot anything obvious I might be missing. Here is my code <?php error_reporting(E_ALL); // include MySQL-processing classes require_once 'mysql.php'; try{ // connect to MySQL $db=new MySQL(array ('host'=>'localhost','user'=>'username','password'=>'password', 'database'=>'DBName')); $searchterm=$db->escapeString($_GET['searchterm']); $result=$db->query("SELECT last_name, first_name,employee_id,title,territory,districts FROM Scores WHERE MATCH(last_name,first_name,employee_id,title,territory,districts) AGAINST ('$searchterm')"); if(!$result->countRows()){ echo '<div class="maincontainer"><h2>No results were found. Go back and try a new search.</h2></div>'."n"; } else{ // display search results echo '<div class="maincontainer"><h2>Your search criteria returned '.$result->countRows().' results.</h2>'."n"; while($row=$result->fetchRow()){ echo '<div class="rowcontainer"><p><strong>First Name: </strong>'.$row['first_name'].'<p><p><strong>Last Name: </strong>'.$row['last_name'].'</p><p><strong>Employee ID: </strong>'.$row['employee_id'].'</p> <p><strong>Title: </strong>'.$row['title'].'</p> <p><strong>Territory: </strong>'.$row['territory'].'</p> <p><strong>Districts: </strong>'.$row['districts'].'</p> </div>'."n"; } } echo '</div>'; } catch(Exception $e){ echo $e->getMessage(); exit(); } ?> and here is the included file mysql.php code <?php // define 'MySQL' class class MySQL{ private $conId; private $host; private $user; private $password; private $database; private $result; const OPTIONS=4; public function __construct($options=array()){ if(count($options)!=self::OPTIONS){ throw new Exception('Invalid number of connection parameters'); } foreach($options as $parameter=>$value){ if(!$value){ throw new Exception('Invalid parameter '.$parameter); } $this->{$parameter}=$value; } $this->connectDB(); } // connect to MySQL private function connectDB(){ if(!$this->conId=mysql_connect($this->host,$this->user,$this- >password)){ throw new Exception('Error connecting to the server'); } if(!mysql_select_db($this->database,$this->conId)){ throw new Exception('Error selecting database'); } } // run query public function query($query){ if(!$this->result=mysql_query($query,$this->conId)){ throw new Exception('Error performing query '.$query); } return new Result($this,$this->result); } public function escapeString($value){ return mysql_escape_string($value); } } // define 'Result' class class Result { private $mysql; private $result; public function __construct(&$mysql,$result){ $this->mysql=&$mysql; $this->result=$result; } // fetch row public function fetchRow(){ return mysql_fetch_assoc($this->result); } // count rows public function countRows(){ if(!$rows=mysql_num_rows($this->result)){ return false; } return $rows; } // count affected rows public function countAffectedRows(){ if(!$rows=mysql_affected_rows($this->mysql->conId)){ throw new Exception('Error counting affected rows'); } return $rows; } // get ID form last-inserted row public function getInsertID(){ if(!$id=mysql_insert_id($this->mysql->conId)){ throw new Exception('Error getting ID'); } return $id; } // seek row public function seekRow($row=0){ if(!is_int($row)||$row<0){ throw new Exception('Invalid result set offset'); } if(!mysql_data_seek($this->result,$row)){ throw new Exception('Error seeking data'); } } } ?> Hi all, first of all sorry if this is in the wrong board, im currently building a site which will charge an annual fee of X amount. I've never build something like this before so Ill be using paypal for ease of use and security, but how would you usually go about constructing the tables etc? |