gags
gags

Reputation: 345

Class not found in fileName.php

I downloaded the example from here:

https://code.msdn.microsoft.com/Bing-Ads-API-Version-9-in-fb27761f

This has been officially provided by the Microsoft community. I downloaded this example and changed

At the top of file ReportRequests.php

The path :

include 'bingads\ReportingClasses.php';
include 'bingads\ClientProxy.php';

was switched to

include 'bingads/ReportingClasses.php';
include 'bingads/ClientProxy.php';

since I am not on windows but linux.

Also, there is

use BingAds\Reporting\KeywordPerformanceReportRequest;

but yet I keep getting

Class 'BingAds\Reporting\KeywordPerformanceReportRequest' not found in fileName.php

on line

 $report = new KeywordPerformanceReportRequest();

Why is it and how do I fix it?

Upvotes: 0

Views: 60

Answers (2)

Jakub Judas
Jakub Judas

Reputation: 787

The namespace used in ReportingClasses.php is BingAds\V9\Reporting.

So the use statement should say

use BingAds\V9\Reporting\KeywordPerformanceReportRequest

Upvotes: 1

Vasim Shaikh
Vasim Shaikh

Reputation: 4512

You have to download a package before use an API you can find here:

https://code.msdn.microsoft.com/Bing-Ads-API-Version-9-in-fb27761f

I think you are missing this two lines at starting of code:

include 'bingads\ReportingClasses.php';
include 'bingads\ClientProxy.php';

Example code :

https://msdn.microsoft.com/en-US/library/bing-ads-php-code-examples.aspx

Upvotes: 0

Related Questions