Monday, 15 April 2013

php - Facebook Ad API creating Campaign issue -


After

I tryng to add an advertisement campaign for FB and SDK through the php and

My code is:

$ ACCOUNT_ID = '653669201111111'; $ APP_ID = '67111971 9111111'; $ APP_SECRET = 'FB 9 / 3535486866817f5f7b85111111'; $ CLIENT_TOKEN = '05483f8023bd5885bef5e2f08611111'; $ APP_TOKEN = '6012878111111'; FacebookSession :: Set default application ($ APP_ID, $ APP_SECRET); // If you already have a valid login token: $ session = new FacebookSession ('05483f8023bd5885bef5e2f086111111'); $ Session = Facebook session: new app session ($ APP_ID, $ APP_SECRET); // To validate session: {$ session-> Validate); } Hold (Facebook \ FacebookRequestException $ ex) {echo $ ex-> GetMessage (); } Hold (\ Exceptions $ east) {echo $ ex-> GetMessage (); } $ __ TOKEN__ = $ session- & gt; GetToken (); $ Session = new \ FacebookAds \ session ($ APP_ID, $ APP_SECRET, $ session-> getToken ()); API :: INIT ($ APP_ID, $ APP_SECRET, $ __ TOKEN__); $ Api = Api :: Example (); $ Campaign = new \ FacebookAds \ object \ AdCampaign (empty, "ACT_ $ ACCOUNT_ID"); $ Campaign- & gt; SetData (array (AdCampaignFields :: name = & gt; 'My First Campaign', AdCampaignFields :: Objective = & gt; AdObjectives :: WEBSITE_CLICKS, AdCampaignFields :: Status = & gt; AdCampaign :: STATUS_PAUSED,)); $ Campaign- & gt; Create (); Echo "Campaign ID:" $ campaign-> ID "\ N"; Die;

And this way the feedback is happening.

I have tried this issue for me, but still have not found anything useful

  FacebookAds [http: response object ([request: protected] = & Gt; [Status: Protected] => 400 [Header: Protected] => FacebookAds \ HTML \ header object ([Storage: Array Object: Private] = & gt; Array [HTTP_CODE] = & gt; HTTP / 1.1 400 incorrect request [content type] => application / json; charset = UTF-8 [WWW-certified] => OAuth "Facebook platform" "invalid_request" "unsupported PO St Request. "[Access-Control-Allow-Origin] = & gt; * [X-FB Plan-Rev] => 1643773 [Pragma] => No Cash [Cash-Control] = & gt; No Shop [Facebook-API-version] => v2.2 [Finish] => Saturn, 01 January 2000 00:00:00 GMT [Vary] => Accept-encoding [X- FB-debug] => HQ7MRN 8ZYmolpN + FckJjwPW2c0 iFwZeoPnegV2oavAvzXURrR5MZxiCLRAGOIr7Q1zaWpM9hEajZxlHiZxirg == [Date] = & gt; Mon, 16 Mar 2015 18:05:22 GMT [Connection] = & gt; Keep-alive [content-length] = & Gt; 90)) [body: protected] = & gt; {"Error": {"Message": "Unsupported post request.", "Type": "GraphmaptException", "Code": 100}} [Content: Protected] = & gt; 

I am using PHP 5.4

Any ideas what's wrong there?

Thank you!


No comments:

Post a Comment