WooCommerce RestFul API URL showing 404 Error - php

I have the Restful settings enabled on the settings page and I have create a user with access keys.
I am using the PHP library and im getting this reponse.
stdClass Object
(
[errors] => Array
(
[0] => stdClass Object
(
[code] => 404
[message] => cURL HTTP error 404
)
)
)
If i visit the url in the browser /wc-api/v1 I also get a 404 response. I have seen some mentions of changing Permalink structure but it doesn't say what too anywhere?
Any pointers? Greatly received :)

Ok so they settings I need were...
Post name http://www.dipdye.co.uk/sample-post/
and
Shop base with category http://www.dipdye.co.uk/shop/product-category/sample-product/
After further reading it seems any 'pretty' url will work, my main issue was it not updating my Web.config file (as Im on IIS) on Apache this would be the .htaccess file.
I can now see something when i visit the page in web browser.
Hope this help someone else too.

Related

Shopify is giving error 400 [Bad Request] when using https://{shop}.myshopify.com/admin/oauth/access_token

I was developing a Shopify App. It was working fine till yesterday evening, but then I started getting the Bad Request [400] error, after the user allow access to the app for his shop.
Error is below
(https://SHOP-NAME.myshopify.com/admin/oauth/access_token) in /path/to/shopify/authentication/oauth.php on line 28
Array (
[method] => POST
[uri] => https://SHOP-NAME.myshopify.com/admin/oauth/access_token
[query] => Array ( )
[headers] => Array ( )
[payload] => Array (
[client_id] => {CLIENTID}
[client_secret] => {CLIENT_SECRET}
[code] => {CODE}
)
)
I'm doing a POST cURL Request with Content-Type:application/x-www-form-urlencode and all the request are validated to be coming from shopify.
If anyone want more information I can provide.
Thanks.
If this happening after the user authorizes the app, it could be an issue with the permanent token they have received. You could try grabbing the token that is generated and doing a POSTMAN request manually to query the API to verify the token works.
If it worked before and you didn't make any changes to the app, it could be a temporary API issue, even though I found that to be rare with my app.
The code parameter that is sent from Shopify can only be used a single time.
If you re-make the original request that sends the code parameter to your server, you should be able to make the call successfully.

how to know where http request 302 leads?

I'm working on Shopify API and trying to register uninstall webhook for my plugin which is registered successfully and i do get a response e.g.
stdClass Object
(
[webhook] => stdClass Object
(
[id] => 52102211
[address] => http://www.example.com/dev1/login?code=42db53dae6d706f095711b8365a941e8&hmac=6ca8a5fa6659ea9b976454d352c73024d98417b0e20665c08090c636d3c9662b&shop=my-shopify-shop.myshopify.comsignature=ed384b260216b100ea2090e0d3c26460×tamp=1438850605/delete_shop
[topic] => app/uninstalled
[created_at] => 2015-08-06T04:43:27-04:00
[updated_at] => 2015-08-06T04:43:27-04:00
[format] => json
[fields] => Array
(
)
[metafield_namespaces] => Array
(
)
)
)
When i delete my plugin it generates a 302 POST request.
I want to see that where does this request leads so that I'd be sure that it is coming straight to my controller action for handling this i.e. to example.com/delete_shop
I'm working in PHP CI and sending email in my code upon the call of this function. Here are the routes:
$route['default_controller'] = "home";
$route['product_edit/:any'] = "home/product_edit";
$route['delete_shop'] = "home/delete_shop";
$route['404_override'] = '';
Is there any problem with my routes because I never receive an email even after hours?
(email functionality is working properly in the application though)
EDIT :
here is the image for the request generated
A 302 is a temporaly redirect. You can follow the requests with tools as:
Firebug (https://getfirebug.com/downloads)
Browser console for developers in Chrome, Safari, Firefox, Internet Explorer, etc.
The tools above make it possible to log the requests. Detailed information provided, such as request headers, response headers, response body, etc.

Instagram Requirements For Callback URL

Recently I had a problem on subscribing to a tag. I get this error:
Array ( [meta] => Array ( [error_type] => APISubscriptionError [code] => 400 [error_message] => Unable to reach callback URL "insert my url here". ) ) ""###
even though my url can be accessed globally.
In the documentation, it says that the callback url must support GET and POST methods. My
callback url passed that requirement but I am still getting the error.
Can somebody tell me what I am missing?

Getting current song info from online radio/tv

I'd like to get the song or program name details from a particular online radio/tv broadcast url. This url could be a file with *.pls extension or in form of mms protocol.
Is there any web request technic, library for php or any popular language?
i am not so sure that this answer will help you, but it can lead you to solution
$url = parse_url(URL);
abouve url will give you an array of the following format
Array
(
[scheme] => http
[host] => eksensc.radyotvonline.com
[path] => /listen.pls
)
you can get $url['path'] from that array,
Hope it hepls ! Thanks

Cannot access Facebook signed_request with an iframe tab

I've got an iframe loading in a facebook tab on a fan page and I'm not having any luck accessing the $_REQUEST["signed_request"] object. I'm confused because this is supposed to be a freebie and easily accessible. I've read and re-read the facebook docs and rechecked my facebook application settings but nothing is working.
isset($_REQUEST['signed_request']
is always false. Since I'm using the Facebook PHP sdk I've also tried
$facebook->getSignedRequest();
I've done print_r on the $_REQUEST and I don't see the signed_request in there. When I print_f the $facebook object, I see that the signedRequest is empty
[appId:protected] => XXX
[apiSecret:protected] => XXXXXXXXXXXXXXXXXXXX
[session:protected] => Array
[access_token] => XXXXXXXXXX|2.h75WqKxcA1xbNPufFvpKQQ__.3600.1304452800.1-726960374|JiO0ZS30SyLaApeqhMtdocK8B_Y
[base_domain] => XXXXXXXXX
[expires] => 1304452800
[secret] => rDF9C_z43_EUFy0Q_e6tyQ__
[session_key] => 2.h75WqKxcA1xbNPufFvpKQQ__.3600.1304452800.1-726960374
[sig] => 1971ef7eb8057c7404eae1f82d770ab5
[uid] => XXXXXXXXXXXXXXX
[signedRequest:protected] =>
[sessionLoaded:protected] => 1
[cookieSupport:protected] => 1
[baseDomain:protected] =>
[fileUploadSupport:protected] =>
[EDIT]
I do have the OAuth 2.0 setting enabled for the application.
OK, just had this on problem myself and found the issue.
Make sure that you do not have a 301 redirect on the canvas or tab page. In my case I set the app up as "mydomain.com/facebook/tab/" but my site was doing a 301 to "www.mydomain.com/facebook/tab/"
The content would show, bit the 301 caused the signedRequest to be null.
Added "www" to my domain in the app settings and the signedRequest now contains the data I was looking for.
I just had this problem. Finally figured it out. I had to add a forward slash to the end of my Tab URLs in the application settings on the Basic tab.
Instead of:
http://domain.com/facebook
I needed:
http://domain.com/facebook/
I had the same problem And I resolve it.
It's a problem with the URLS. Be sure that your
App Domain & Page Tab URL match the same domain for example:
1) App domain: example.com
Page Tab URL: example.com
will work
2) App domain: example.com
Page Tab URL: example.com/app/
will work
3) App domain: fb.example.com
Page Tab URL: fb.example.com/app/
will work
4) App domain: fb.example.com
Page Tab URL: example.com/fb
will not work
After some investigation, I suspect this has something to do with where the iframe source is hosted.
When I moved everything to localhost, the signed_request started coming in fine.
Edit the settings of your tab application.
On "Advanced" tab, make sure "OAuth 2.0 for Canvas" is enabled.
it's an old question but I found this with google...
the problem for me was that I did a manual redirect to the https url of my pagetab and than the $_POST['signed_request'] got lost

Categories