Jump to content

Paulkirkewalker

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Paulkirkewalker's Achievements

Member

Member (2/5)

0

Reputation

  1. Hi there, I've used the cUrl library to return a query string from a remote server to a variable. The query string looks a bit like this: ...php?message_id=a1&recipient=unit1&sendday=fri At the moment, the whole of this query string is contained in a single variable ($qstring) so if I print $qstring, "message_id=a1&recipient=unit1&sendday=fri" will be sent to the browser. Can anyone tell me how to break the values "a1", "unit1" and "fri" into individual variables so that I can start using them in the rest of my code like this: $message_id = "a1"; $recipient = "unit1"; $sendday = "fri"; I'd like to achive this in the same php script rather than sending it to another page to GET the elements of the query string. Thanks in advance, Paul.
  2. Hi there, Can anyone tell me in simple terms what the following error means? PHP Notice: Use of undefined constant CURLOPT_GETFIELDS - assumed 'CURLOPT_GETFIELDS' in C:\Inetpub\wwwroot\test2-1.php on line 28 Thanks, Paul.
  3. Hi there, I’m having a real heap of trouble with PHP and cURL. My aim is to use this code (or something like it) to submit 2 fields to a remote server (using GET) and receive back 6 fields (again with GET). When I run the function below, I get back a 401 unauthorized error although the Username and Password are correct. Presumably then, they are not reaching the remote server at all or in the correct state. Problem is, I know so little about cURL that I don’t know what the correct state is., and that’s before I start worrying about getting data back from the server! Below is the guide from the service provider about communicating with their server. Unfortunately they have been of absolutely no help so far so I’d be really grateful if you could give me any suggestions about where I am going wrong and what I should do instead. Yours, Paul. //Constants $bcUser = 'ConnectBusinessUK'; $bcPass = 'xxxxxx'; $bcURL = 'http://service.bulletinconnect.net/api/1/sms/in'; $bcRatecode = FALSE; //Receive function function Receive($user, $pass) { global $bcURL; $data = "userId=".urlencode($user) . "&password=".urlencode($pass); $cUrl = curl_init(); curl_setopt($cUrl, CURLOPT_URL, $bcURL); curl_setopt($cUrl, CURLOPT_HEADER, 'Content-type: application/x-www-form-urlencoded'); curl_setopt($cUrl, CURLOPT_GET, 1); curl_setopt($cUrl, CURLOPT_GETFIELDS, $data); curl_setopt($cUrl, CURLOPT_TIMEOUT, 30); curl_exec($cUrl); $code = curl_getinfo($cUrl, CURLINFO_HTTP_CODE); curl_close($cUrl); return ($code == 200 || $code == 204) ? TRUE : FALSE; } //Execute function Receive($bcUser, $bcPass); ************************************************************************ To Receive a Message Clients can GET incoming messages from http://service.bulletinconnect.net/api/1/sms/in . Users of the AAPT Bulletin Connect will need to use a different URL for Sending and Receiving Messages/Staus updates. See the AAPT Bulletin Connect section for more details on what URL you should use. Required Input parameters are: • userId • password The userId and password are supplied to you by Bulletin Wireless when you sign up for a Bulletin Connect account. You may pass them to the server in a query string, or in the HTTP Authorization header in Basic format. Bulletin Connect will respond to each and every HTTP request with one of the following result codes. • 200- OK • 204- No content to return • 401- Unauthorized • 500- Internal error For 200 codes (success) Bulletin Connect will include a form encoded parameter list containing message information as described here • messageID • from • to • rateCode • inReplyTold • body N.B. The order of the parameters may change so use value/pair matching rather than location mapping.
  4. Hi, Thanks for helping me out, I'm absolutely stuck with this one! I'm confused about where the line $get_url = $bcURL . '?' . $data; should go though. Should it be like this? I guess not because I'm still getting the same error message. Thanks, Paul. /* Constants */ $bcUser = 'xxxxx'; $bcPass = 'yyyyy'; $bcURL = 'http://service.bulletinconnect.net/api/1/sms/in'; $bcRatecode = FALSE; /* Send the request */ RequestIncoming($bcUser, $bcPass); /*RequestIncoming Function */ function RequestIncoming($user, $pass) { global $bcURL; print 'user: ' . $user . '<p>'; print 'pass: ' . $pass . '<p>'; $data = "userId=".urlencode($user) . "&password=".urlencode($pass); print 'data: ' . $data; $get_url = $bcURL . '?' . $data; $cUrl = curl_init(); curl_setopt($cUrl, CURLOPT_URL, $bcURL); curl_setopt($cUrl, CURLOPT_TIMEOUT, 30); curl_exec($cUrl); $code = curl_getinfo($cUrl, CURLINFO_HTTP_CODE); curl_close($cUrl); return $code; print 'code: ' . $code; }
  5. Hi there, Can any of you nice people see what's wrong with this snippet of PHP code using cURL? I'm really not that familiar with the library so I'm really just amending existing scripts. My thoughts arethat the credentials are not being encoded into the URL (maybe?). Thanks in advance, Paul. <?php /* Constants */ $bcUser = 'yyyyyyy'; $bcPass = 'xxxxxxxx'; $bcURL = 'http://service.bulletinconnect.net/api/1/sms/in'; $bcRatecode = FALSE; /* Send the request */ RequestIncoming($bcUser, $bcPass); /*RequestIncoming Function */ function RequestIncoming($user, $pass) { global $bcURL; print 'user: ' . $user . '<p>'; print 'pass: ' . $pass . '<p>'; $data = "userId=".urlencode($user) . "&password=".urlencode($pass); print 'data: ' . $data; $cUrl = curl_init(); curl_setopt($cUrl, CURLOPT_URL, $bcURL); curl_setopt($cUrl, CURLOPT_HEADER, 'Content-type: application/x-www-form-urlencoded'); curl_setopt($cUrl, CURLOPT_GET, 1); curl_setopt($cUrl, CURLOPT_GETFIELDS, $data); curl_setopt($cUrl, CURLOPT_TIMEOUT, 30); curl_exec($cUrl); $code = curl_getinfo($cUrl, CURLINFO_HTTP_CODE); curl_close($cUrl); return $code; print 'code: ' . $code; }
  6. Hi there, I'm having some trouble understanding what I am supposed to do to implement the directions that I've pasted below. The directions are from a provider of a messaging service that we subscribe to. I've no problem with using GET or POST to send the required input fields to the server but when it comes to receiving the second list of parameters back, I'm lost. I created a form with the GET method and the url supplied by the service provider as the action. When I submit the userID and password parameters to the server with this form, my browser is offered a data file to download. I'm sure that this data is not intended to be downloaded in a file but is really meant to be interpreted by $_GET. My problem is that by using the GET method, the browser is directed to the action url, but in order to make use of the data sent back by the action url, i need to be browsing to a location where my php page can use GET to interpret this data. Do I need some way to submit the input parameters to the service provider's url but then direct the browser (and the returned data) to a php page that can use $_GET to interpret the output data? Sorry if this doesn't make much sense. I might be way off track with some of the concepts here. Thanks in advance, Paul. Here's what the service provider's manual has to say: You can poll the server for incoming messages: Clients can GET incoming messages from http://service.bulletinconnect.net/api/1/sms/in. Required Input parameters are: userId password You may pass these parameters to the server in a query string, or in the HTTP Authorization header in Basic format. The server will return a form encoded parameter list containing message information as described here: messageId Source MSISDN Destination MSISDN rateCode inReplyToId Correlation ID body N.B. The order of the parameters may change so use value/pair matching rather than location mapping.
  7. Hi ToonMariner, Nice to hear from Newcastle. I went to uni there but now live in Edinburgh. I'm afraid I still need a bit more of a point in the right direction though. I created a form with the GET method and the url supplied by the service provider as the action. When I submit the userID and password parameters to the server with this form, my browser is offered a data file to download. I'm sure that this data is not intended to be downloaded in a file but is really meant to be interpreted by $_GET. My problem is that by using the GET method, the browser is directed to the action url, but in order to make use of the data sent back by the action url, i need to be browsing to a location where my php page can use GET to interpret this data. Do I need some way to submit the input parameters to the service provider's url but then direct the browser (and the returned data) to a php page that can use $_GET to interpret the output data? Sorry if this doesn't make much sense. I might be way off track with some of the concepts here. Yours, Paul.
  8. Hi there, I'm not that experienced with using GET, I've only used it in HTML to send data to a query string and in PHP to read data from a query string into variables. So the following instructions from the provider of a messaging service that we subscribe to really have me puzzled. I've no problem with using GET or POST to send the required input fields to the server but when it comes to receiving the second list of paremeters back, I'm lost. Can anyone help? Thanks in advance, Paul. Here's what the service provider's manual has to say: You can poll the server for incoming messages: Clients can GET incoming messages from http://service.bulletinconnect.net/api/1/sms/in. Required Input parameters are: userId password You may pass these parameters to the server in a query string, or in the HTTP Authorization header in Basic format. The server will return a form encoded parameter list containing message information as described here: messageId Source MSISDN Destination MSISDN rateCode inReplyToId Correlation ID body N.B. The order of the parameters may change so use value/pair matching rather than location mapping.
  9. Hi veridicus, Here's the story: We have an online form which collects data that has to end up in our Microsoft Access database on our LAN. At the moment, the data is just emailed to us from the form so getting it into the database is very time consuming. The data doesn't need to be very "live" at all. One the data is submitted from the form it won't be changing again until it is in the Access database. What I'm looking for is a way to cut out the need to email the data from the form and enter it manually to the database. The online database would only act as a bridge between the form and the access db. I'd certainly be looking at periodic dumps from MySQL to Access but the problem is getting them to talk to each other. I am familiar with MyODBC but I can't use it to connect from our LAN to the MySQL database as the MySQL server is a commercial shared one and can only be accessed from web space supplied by the hosting company. It might be that MySQL isn't the best "bridge" to use. I'm looking at using a .csv or even .txt file instead but I'd prefer to use MySQL. Do you have any ideas?
  10. Hi Everyone, I'm looking for a way to write data to a MySQL db (no problem so far) and then access the data on MySQL from a Microsoft Access database on our LAN. My first thought was to use the MyODBC driver from MySQL but because our databases are on shared webhosting (1and1) you can only access them from 1and1 webspace. I can't run MS Access on the webserver because the hosting package is Linux. Does anyone have any ideas about how to accomplish this? Do you know a clever work around for getting the databases to talk despite the problem with the shared hosting? Maybe the answer is to use a flat file database of some kind? What do you think? I'd love to hear your ideas. Yours, Paul.
  11. Hi there, I have two tables: properties and images.  They are linked by the primary key of properties, property_id.  Some records in properties have more than one record in images associated with them  and some have none at all. What I am trying to do is return all the records in properties, whether they have an associated record in images or not [i]but[/i] only return one record (it doesn't matter which) for those which have more than one record in images associated with them. If I run: [code] SELECT images.* FROM images GROUP BY images.property_id [/code] I get just one record associated with each property.  Fine.  My query linking properties and images runs fine too: [code]SELECT properties.*, images.* FROM images RIGHT JOIN properties ON images.property_id = properties.property_id; [/code] As expected, it returns every record in properties along with associted records in images whether any exist or not.  The problem comes when I try to add the GROUP BY line to this query: [code] SELECT properties.*, images.* FROM images RIGHT JOIN properties ON images.property_id = properties.property_id; GROUP BY images.property_id [/code] I just get this error: #1064 - You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near 'GROUP BY images.property_id' at line 1 Can anyone help?  This is driving me mad!  I accept that my approach with these queries may be completely wrong to start with so I'd be very grateful for any advice. Thanks, Paul. But when I add the same GROUP BY line to the end on
  12. Hi there, I'm relatively new to PHP and mySQL.  I am far more used to using Access and VBA so sorry if I use the wrong terminology here. In access it is very straightforward, using reports to group the results of a query.  For example, the results: Paul, Edinburgh Jo, Glasgow Nicky, Edinburgh James, Leeds can be easily represented like this: Glasgow           Jo Edinburgh           Nicky           Paul Leeds           James In Access reports this is called grouping.  I need to do the same in PHP/mySQL to show all the images linked to a parent record together under the parent record's details rather than show each as a seperate result with the parent record's details shown for each image in turn. Any ideas? Thanks, Paul.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.